diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/accordion/accordion_methods.js | 22 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 41 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_methods.js | 18 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_methods.js | 18 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar_methods.js | 5 | ||||
-rw-r--r-- | tests/unit/resizable/resizable_methods.js | 12 | ||||
-rw-r--r-- | tests/unit/selectable/selectable_methods.js | 18 | ||||
-rw-r--r-- | tests/unit/slider/slider_methods.js | 12 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_methods.js | 18 |
9 files changed, 148 insertions, 16 deletions
diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 8b3a491a8..e13a4a47e 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -10,17 +10,32 @@ test("init", function() { }); test("destroy", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('destroy'); + equals(actual, expected, 'destroy is chainable'); ok(false, 'missing test - untested code is broken code'); }); test("enable", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('enable'); + equals(actual, expected, 'enable is chainable'); ok(false, 'missing test - untested code is broken code'); }); test("disable", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('disable'); + equals(actual, expected, 'disable is chainable'); ok(false, 'missing test - untested code is broken code'); }); +test("activate", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('activate', 2); + equals(actual, expected, 'activate is chainable'); +}); + test("activate, numeric", function() { var ac = $('#list1').accordion({ active: 1 }); state(ac, 0, 1, 0); @@ -74,4 +89,11 @@ test("activate, jQuery or DOM element", function() { state(ac, 0, 1, 0); }); +test("resize", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('resize'); + equals(actual, expected, 'resize is chainable'); + ok(false, 'missing test - untested code is broken code'); +}); + })(jQuery); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 897c74581..5748a27da 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -33,7 +33,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').dialog().dialog("destroy").remove(); ok(true, '.dialog("destroy") called on element'); @@ -54,6 +54,31 @@ test("destroy", function() { $('<div></div>').dialog().dialog("destroy").data("foo.dialog", "bar").remove(); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').dialog(), + actual = expected.dialog('destroy'); + equals(actual, expected, 'destroy is chainable'); +}); + +test("enable", function() { + var expected = $('<div></div>').dialog(), + actual = expected.dialog('enable'); + equals(actual, expected, 'enable is chainable'); + ok(false, 'missing test - untested code is broken code'); +}); + +test("disable", function() { + var expected = $('<div></div>').dialog(), + actual = expected.dialog('disable'); + equals(actual, expected, 'disable is chainable'); + ok(false, 'missing test - untested code is broken code'); +}); + +test("close", function() { + var expected = $('<div></div>').dialog(), + actual = expected.dialog('close'); + equals(actual, expected, 'close is chainable'); + ok(false, 'missing test - untested code is broken code'); }); test("isOpen", function() { @@ -72,4 +97,18 @@ test("isOpen", function() { el.remove(); }); +test("moveToTop", function() { + var expected = $('<div></div>').dialog(), + actual = expected.dialog('moveToTop'); + equals(actual, expected, 'moveToTop is chainable'); + ok(false, 'missing test - untested code is broken code'); +}); + +test("open", function() { + var expected = $('<div></div>').dialog(), + actual = expected.dialog('open'); + equals(actual, expected, 'open is chainable'); + ok(false, 'missing test - untested code is broken code'); +}); + })(jQuery); diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js index 6a931bfe7..9de83e451 100644 --- a/tests/unit/draggable/draggable_methods.js +++ b/tests/unit/draggable/draggable_methods.js @@ -38,7 +38,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').draggable().draggable("destroy").remove(); ok(true, '.draggable("destroy") called on element'); @@ -57,10 +57,14 @@ test("destroy", function() { $("<div></div>").draggable().draggable("destroy").data("foo.draggable", "bar"); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').draggable(), + actual = expected.draggable('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { - expect(6); + expect(7); el = $("#draggable2").draggable({ disabled: true }); shouldnotmove('.draggable({ disabled: true })'); el.draggable("enable"); @@ -73,10 +77,14 @@ test("enable", function() { el.data("disabled.draggable", false); equals(el.data("disabled.draggable"), false, "disabled.draggable setter"); shouldmove('.data("disabled.draggable", false)'); + + var expected = $('<div></div>').draggable(), + actual = expected.draggable('enable'); + equals(actual, expected, 'enable is chainable'); }); test("disable", function() { - expect(6); + expect(7); el = $("#draggable2").draggable({ disabled: false }); shouldmove('.draggable({ disabled: false })'); el.draggable("disable"); @@ -90,6 +98,10 @@ test("disable", function() { el.data("disabled.draggable", true); equals(el.data("disabled.draggable"), true, "disabled.draggable setter"); shouldnotmove('.data("disabled.draggable", true)'); + + var expected = $('<div></div>').draggable(), + actual = expected.draggable('disable'); + equals(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index 51f54089d..51cb65e74 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -28,7 +28,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').droppable().droppable("destroy").remove(); ok(true, '.droppable("destroy") called on element'); @@ -47,10 +47,14 @@ test("destroy", function() { $("<div></div>").droppable().droppable("destroy").data("foo.droppable", "bar"); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').droppable(), + actual = expected.droppable('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { - expect(6); + expect(7); el = $("#droppable1").droppable({ disabled: true }); shouldNotBeDroppable(); el.droppable("enable"); @@ -62,10 +66,14 @@ test("enable", function() { el.data("disabled.droppable", false); equals(el.data("disabled.droppable"), false, "disabled.droppable setter"); shouldBeDroppable(); + + var expected = $('<div></div>').droppable(), + actual = expected.droppable('enable'); + equals(actual, expected, 'enable is chainable'); }); test("disable", function() { - expect(6); + expect(7); el = $("#droppable1").droppable({ disabled: false }); shouldBeDroppable(); el.droppable("disable"); @@ -77,6 +85,10 @@ test("disable", function() { el.data("disabled.droppable", true); equals(el.data("disabled.droppable"), true, "disabled.droppable setter"); shouldNotBeDroppable(); + + var expected = $('<div></div>').droppable(), + actual = expected.droppable('disable'); + equals(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index ece100e02..9a162685b 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -14,11 +14,14 @@ test("init", function() { }); test("destroy", function() { - expect(1); + expect(2); $("<div></div>").appendTo('body').progressbar().progressbar("destroy").remove(); ok(true, '.progressbar("destroy") called on element'); + var expected = $('<div></div>').progressbar(), + actual = expected.progressbar('destroy'); + equals(actual, expected, 'destroy is chainable'); }); })(jQuery); diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js index 43d573387..e029e00cf 100644 --- a/tests/unit/resizable/resizable_methods.js +++ b/tests/unit/resizable/resizable_methods.js @@ -30,7 +30,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').resizable().resizable("destroy").remove(); ok(true, '.resizable("destroy") called on element'); @@ -51,13 +51,23 @@ test("destroy", function() { $('<div></div>').resizable().resizable("destroy").data("foo.resizable", "bar").remove(); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').resizable(), + actual = expected.resizable('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { + var expected = $('<div></div>').resizable(), + actual = expected.resizable('enable'); + equals(actual, expected, 'enable is chainable'); ok(false, "missing test - untested code is broken code."); }); test("disable", function() { + var expected = $('<div></div>').resizable(), + actual = expected.resizable('disable'); + equals(actual, expected, 'disable is chainable'); ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js index 0f52ec7e4..4d1701440 100644 --- a/tests/unit/selectable/selectable_methods.js +++ b/tests/unit/selectable/selectable_methods.js @@ -30,7 +30,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').selectable().selectable("destroy").remove(); ok(true, '.selectable("destroy") called on element'); @@ -51,10 +51,14 @@ test("destroy", function() { $("<div></div>").selectable().selectable("destroy").data("foo.selectable", "bar").remove(); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').selectable(), + actual = expected.selectable('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { - expect(2); + expect(3); var fired = false; el = $("#selectable1"); @@ -68,10 +72,14 @@ test("enable", function() { el.simulate("drag", 20, 20); equals(fired, true, "start fired"); el.selectable("destroy"); + + var expected = $('<div></div>').selectable(), + actual = expected.selectable('enable'); + equals(actual, expected, 'enable is chainable'); }); test("disable", function() { - expect(2); + expect(3); var fired = false; el = $("#selectable1"); @@ -86,6 +94,10 @@ test("disable", function() { el.simulate("drag", 20, 20); equals(fired, false, "start fired"); el.selectable("destroy"); + + var expected = $('<div></div>').selectable(), + actual = expected.selectable('disable'); + equals(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 05b8905b1..92d8237b9 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -30,7 +30,7 @@ test("init", function() { }); test("destroy", function() { - expect(8); + expect(9); $("<div></div>").appendTo('body').slider().slider("destroy").remove(); ok(true, '.slider("destroy") called on element'); @@ -59,13 +59,23 @@ test("destroy", function() { $('<div></div>').slider().slider("destroy").slider("options", "foo", "bar").remove(); ok(true, 'arbitrary option setter (.slider option method) after destroy'); + + var expected = $('<div></div>').slider(), + actual = expected.slider('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { + var expected = $('<div></div>').slider(), + actual = expected.slider('enable'); + equals(actual, expected, 'enable is chainable'); ok(false, "missing test - untested code is broken code."); }); test("disable", function() { + var expected = $('<div></div>').slider(), + actual = expected.slider('disable'); + equals(actual, expected, 'disable is chainable'); ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index e19ccc58f..74d7be02e 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -45,7 +45,7 @@ test("init", function() { }); test("destroy", function() { - expect(6); + expect(7); $("<div></div>").appendTo('body').sortable().sortable("destroy").remove(); ok(true, '.sortable("destroy") called on element'); @@ -64,10 +64,14 @@ test("destroy", function() { $("<div></div>").sortable().sortable("destroy").data("foo.sortable", "bar"); ok(true, 'arbitrary option setter after destroy'); + + var expected = $('<div></div>').sortable(), + actual = expected.sortable('destroy'); + equals(actual, expected, 'destroy is chainable'); }); test("enable", function() { - expect(4); + expect(5); el = $("#sortable").sortable({ disabled: true }); sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })'); @@ -81,10 +85,14 @@ test("enable", function() { equals(el.data("disabled.sortable"), false, "disabled.sortable setter"); sort($("li", el)[0], 0, 40, 2, '.data("disabled.sortable", false)'); + + var expected = $('<div></div>').sortable(), + actual = expected.sortable('enable'); + equals(actual, expected, 'enable is chainable'); }); test("disable", function() { - expect(5); + expect(6); el = $("#sortable").sortable({ disabled: false }); sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); @@ -98,6 +106,10 @@ test("disable", function() { el.data("disabled.sortable", true); equals(el.data("disabled.sortable"), true, "disabled.sortable setter"); sort($("li", el)[0], 0, 40, 0, '.data("disabled.sortable", true)'); + + var expected = $('<div></div>').sortable(), + actual = expected.sortable('disable'); + equals(actual, expected, 'disable is chainable'); }); })(jQuery); |