diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-10-13 21:32:42 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-10-13 21:32:42 +0000 |
commit | b6cb342c6595e086305a0f8efa93c48280f4806e (patch) | |
tree | 710a0d113e3bcbdad452ef2ffc8ea9c978aa289a /tests | |
parent | 59109b7894a3e6d203c7c711984860def740cff3 (diff) | |
download | jquery-ui-b6cb342c6595e086305a0f8efa93c48280f4806e.tar.gz jquery-ui-b6cb342c6595e086305a0f8efa93c48280f4806e.zip |
updating tests to latest QUnit, using same, fixing a few assertions that relied on type casting (mostly null/undefined)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dialog.js | 20 | ||||
-rw-r--r-- | tests/draggable.js | 14 | ||||
-rw-r--r-- | tests/resizable.js | 18 | ||||
-rw-r--r-- | tests/selectable.js | 6 | ||||
-rw-r--r-- | tests/tabs.js | 7 |
5 files changed, 27 insertions, 38 deletions
diff --git a/tests/dialog.js b/tests/dialog.js index e01e86e66..3b228ca87 100644 --- a/tests/dialog.js +++ b/tests/dialog.js @@ -11,11 +11,11 @@ var defaults = { autoResize: true, buttons: {}, disabled: false, - dialogClass: null, + dialogClass: undefined, draggable: true, height: 200, - maxHeight: null, - maxWidth: null, + maxHeight: undefined, + maxWidth: undefined, minHeight: 100, minWidth: 150, modal: false, @@ -67,7 +67,7 @@ function moved(dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: offsetAfter.left, top: offsetAfter.top }; var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy }; - compare2(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldmove(why) { @@ -86,7 +86,7 @@ function resized(dw, dh, msg) { msg = msg ? msg + "." : ""; var actual = { width: widthAfter, height: heightAfter }; var expected = { width: widthBefore + dw, height: heightBefore + dh }; - compare2(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldresize(why) { @@ -185,10 +185,8 @@ test("element types", function() { test("defaults", function() { el = $('<div/>').dialog(); $.each(defaults, function(key, val) { - var actual = el.data(key + ".dialog"), expected = val, - method = (expected && expected.constructor == Object) ? - compare2 : equals; - method(actual, expected, key); + var actual = el.data(key + ".dialog"), expected = val; + same(actual, expected, key); }); el.remove(); }); @@ -244,7 +242,7 @@ test("autoResize", function() { handle = $(".ui-resizable-se", dlg()); drag(handle, 50, 50); actual = { height: el.height() }; - compare2(actual, expected, '.dialog({ autoResize: false })'); + same(actual, expected, '.dialog({ autoResize: false })'); el.remove(); el = $('<div>content<br>content<br>content<br>content<br>content</div>').dialog({ autoResize: true }); before = { width: el.width(), height: el.height() }; @@ -252,7 +250,7 @@ test("autoResize", function() { drag(handle, 50, 50); expected = { width: before.width + 50, height: before.height + 50 }; actual = { width: el.width(), height: el.height() }; - compare2(actual, expected, '.dialog({ autoResize: true })'); + same(actual, expected, '.dialog({ autoResize: true })'); el.remove(); }); diff --git a/tests/draggable.js b/tests/draggable.js index c3a4b2353..f14ab78f8 100644 --- a/tests/draggable.js +++ b/tests/draggable.js @@ -22,7 +22,7 @@ var moved = function (dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: offsetAfter.left, top: offsetAfter.top }; var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy }; - compare2(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldmove(why) { @@ -266,7 +266,7 @@ test("{ containment: 'parent' }, relative", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - compare2(offsetAfter, expected, 'compare offset to parent'); + same(offsetAfter, expected, 'compare offset to parent'); }); test("{ containment: 'parent' }, absolute", function() { @@ -277,7 +277,7 @@ test("{ containment: 'parent' }, absolute", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - compare2(offsetAfter, expected, 'compare offset to parent'); + same(offsetAfter, expected, 'compare offset to parent'); }); test("{ cursor: 'move' }", function() { @@ -571,7 +571,7 @@ test("{ helper: 'clone' }, absolute", function() { drag(el, 1, 1); - compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); }); @@ -587,7 +587,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() { drag(el, 1, 1); - compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main")[0].scrollTop = 0; }); @@ -604,7 +604,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() { drag(el, 1, 1); - compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $(document).scrollTop(0); }); @@ -622,7 +622,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func drag(el, 1, 1); - compare2({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $(document).scrollTop(0); $("#main")[0].scrollTop = 0; diff --git a/tests/resizable.js b/tests/resizable.js index f238726a4..c091c14d9 100644 --- a/tests/resizable.js +++ b/tests/resizable.js @@ -21,19 +21,19 @@ var drag = function(el, dx, dy, complete) { }; var defaults = { - alsoResize: null, + alsoResize: undefined, aspectRatio: false, autoHide: false, - containment: null, - grid: null, + containment: undefined, + grid: undefined, handles: 'e,s,se', helper: null, disabled: false, - maxHeight: null, - maxWidth: null, + maxHeight: undefined, + maxWidth: undefined, minHeight: 10, minWidth: 10, - proportionallyResize: null + proportionallyResize: undefined }; // Resizable Tests @@ -107,10 +107,8 @@ test("element types", function() { test("defaults", function() { el = $('<div/>').resizable(); $.each(defaults, function(key, val) { - var actual = el.data(key + ".resizable"), expected = val, - method = (expected && expected.constructor == Object) ? - compare2 : equals; - method(actual, expected, key); + var actual = el.data(key + ".resizable"), expected = val; + same(actual, expected, key); }); el.remove(); }); diff --git a/tests/selectable.js b/tests/selectable.js index 267b88931..1d0ea53d4 100644 --- a/tests/selectable.js +++ b/tests/selectable.js @@ -79,10 +79,8 @@ test("defaults", function() { filter: '*' }; $.each(defaults, function(key, val) { - var actual = el.data(key + ".selectable"), expected = val, - method = (expected && expected.constructor == Object) ? - compare2 : equals; - method(actual, expected, key); + var actual = el.data(key + ".selectable"), expected = val; + same(actual, expected, key); }); el.remove(); }); diff --git a/tests/tabs.js b/tests/tabs.js index e27bd7def..1e43c5581 100644 --- a/tests/tabs.js +++ b/tests/tabs.js @@ -61,12 +61,7 @@ module('tabs'); for (var optionName in expected) { var actual = el.data(optionName + '.tabs'), expects = expected[optionName]; - - if (optionName == 'disabled') - compare(actual, expects, optionName); - else - equals(actual, expects, optionName); - + same(actual, expects, optionName); } }); |