diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/accordion/accordion_methods.js | 12 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 14 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_options.js | 24 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_methods.js | 28 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_methods.js | 24 | ||||
-rw-r--r-- | tests/unit/resizable/resizable_methods.js | 14 | ||||
-rw-r--r-- | tests/unit/selectable/selectable_methods.js | 14 | ||||
-rw-r--r-- | tests/unit/slider/slider_methods.js | 22 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_methods.js | 26 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_methods.js | 22 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_options.js | 22 |
11 files changed, 71 insertions, 151 deletions
diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 85812c535..6761d24a6 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -31,11 +31,11 @@ test("init", function() { ok(true, 'arbitrary method called after init'); var el = $('<div></div>').accordion(); - var foo = el.data("foo.accordion"); + var foo = el.accordion("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); - $('<div></div>').accordion().data("foo.accordion", "bar").remove(); + $('<div></div>').accordion().accordion("option", "foo", "bar").remove(); ok(true, 'arbitrary option setter after init'); }); @@ -52,14 +52,6 @@ test("destroy", function() { $('<div></div>').accordion().accordion("destroy").accordion("foo").remove(); ok(true, 'arbitrary method called after destroy'); - var el = $('<div></div>').accordion(); - var foo = el.accordion("destroy").data("foo.accordion"); - el.remove(); - ok(true, 'arbitrary option getter after destroy'); - - $('<div></div>').accordion().accordion("destroy").data("foo.accordion", "bar").remove(); - ok(true, 'arbitrary option setter after destroy'); - var expected = $('<div></div>').accordion(), actual = expected.accordion('destroy'); equals(actual, expected, 'destroy is chainable'); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index dcb2409d4..93d1b25db 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -28,17 +28,15 @@ test("init", function() { ok(true, 'arbitrary method called after init'); el = $('<div></div>').dialog(); - var foo = el.data("foo.dialog"); + var foo = el.dialog("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); - $('<div></div>').dialog().data("foo.dialog", "bar").remove(); + $('<div></div>').dialog().dialog("option", "foo", "bar").remove(); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').dialog().dialog("destroy").remove(); ok(true, '.dialog("destroy") called on element'); @@ -51,14 +49,6 @@ test("destroy", function() { $('<div></div>').dialog().dialog("destroy").dialog("foo").remove(); ok(true, 'arbitrary method called after destroy'); - el = $('<div></div>').dialog(); - var foo = el.dialog("destroy").data("foo.dialog"); - el.remove(); - ok(true, 'arbitrary option getter after destroy'); - - $('<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'); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 761f03b27..28b3812b5 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -54,9 +54,9 @@ test("buttons", function() { } }; - same(el.data("buttons.dialog"), buttons, '.data("buttons.dialog") getter'); - el.data("buttons.dialog", newButtons); - same(el.data("buttons.dialog"), newButtons, '.data("buttons.dialog", ...) setter'); + same(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); + el.dialog("option", "buttons", newButtons); + same(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); btn = $("button", dlg()); equals(btn.length, 1, "number of buttons after setter"); @@ -155,7 +155,7 @@ test("height", function() { el.remove(); el = $('<div></div>').dialog(); - el.data('height.dialog', 438); + el.dialog('option', 'height', 438); equals(dlg().height(), 438, "explicit height set after init"); el.remove(); }); @@ -173,7 +173,7 @@ test("maxHeight", function() { equals(heightAfter, 400, "maxHeight"); el.remove(); - el = $('<div></div>').dialog({ maxHeight: 400 }).data('maxHeight.dialog', 600); + el = $('<div></div>').dialog({ maxHeight: 400 }).dialog('option', 'maxHeight', 600); drag('.ui-resizable-n', -1000, -1000); equals(heightAfter, 600, "maxHeight"); el.remove(); @@ -192,7 +192,7 @@ test("maxWidth", function() { equals(widthAfter, 400, "maxWidth"); el.remove(); - el = $('<div></div>').dialog({ maxWidth: 400 }).data('maxWidth.dialog', 600); + el = $('<div></div>').dialog({ maxWidth: 400 }).dialog('option', 'maxWidth', 600); drag('.ui-resizable-w', -1000, -1000); equals(widthAfter, 600, "maxWidth"); el.remove(); @@ -211,7 +211,7 @@ test("minHeight", function() { equals(heightAfter, 10, "minHeight"); el.remove(); - el = $('<div></div>').dialog({ minHeight: 10 }).data('minHeight.dialog', 30); + el = $('<div></div>').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30); drag('.ui-resizable-n', 1000, 1000); equals(heightAfter, 30, "minHeight"); el.remove(); @@ -230,7 +230,7 @@ test("minWidth", function() { equals(widthAfter, 10, "minWidth"); el.remove(); - el = $('<div></div>').dialog({ minWidth: 30 }).data('minWidth.dialog', 30); + el = $('<div></div>').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30); drag('.ui-resizable-w', 1000, 1000); equals(widthAfter, 30, "minWidth"); el.remove(); @@ -258,13 +258,13 @@ test("resizable", function() { el = $('<div></div>').dialog(); shouldresize("[default]"); - el.data('resizable.dialog', false); + el.dialog('option', 'resizable', false); shouldnotresize('disabled after init'); el.remove(); el = $('<div></div>').dialog({ resizable: false }); shouldnotresize("disabled in init options"); - el.data('resizable.dialog', true); + el.dialog('option', 'resizable', true); shouldresize('enabled after init'); el.remove(); }); @@ -296,7 +296,7 @@ test("title", function() { equals(titleText(), "bar", "title in init options should override title in element attribute"); el.remove(); - el = $('<div></div>').dialog().data('title.dialog', 'foo'); + el = $('<div></div>').dialog().dialog('option', 'title', 'foo'); equals(titleText(), 'foo', 'title after init'); el.remove(); }); @@ -310,7 +310,7 @@ test("width", function() { el = $('<div></div>').dialog({width: 437 }); equals(dlg().width(), 437, "explicit width"); - el.data('width.dialog', 438); + el.dialog('option', 'width', 438); equals(dlg().width(), 438, 'explicit width after init'); el.remove(); }); diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js index 9de83e451..4ffadf09e 100644 --- a/tests/unit/draggable/draggable_methods.js +++ b/tests/unit/draggable/draggable_methods.js @@ -30,16 +30,14 @@ test("init", function() { $("<div></div>").draggable().draggable("foo"); ok(true, 'arbitrary method called after init'); - $("<div></div>").draggable().data("foo.draggable"); + $("<div></div>").draggable().draggable("option", "foo"); ok(true, 'arbitrary option getter after init'); - $("<div></div>").draggable().data("foo.draggable", "bar"); + $("<div></div>").draggable().draggable("option", "foo", "bar"); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').draggable().draggable("destroy").remove(); ok(true, '.draggable("destroy") called on element'); @@ -52,12 +50,6 @@ test("destroy", function() { $("<div></div>").draggable().draggable("destroy").draggable("foo"); ok(true, 'arbitrary method called after destroy'); - $("<div></div>").draggable().draggable("destroy").data("foo.draggable"); - ok(true, 'arbitrary option getter after destroy'); - - $("<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'); @@ -69,14 +61,14 @@ test("enable", function() { shouldnotmove('.draggable({ disabled: true })'); el.draggable("enable"); shouldmove('.draggable("enable")'); - equals(el.data("disabled.draggable"), false, "disabled.draggable getter"); + equals(el.draggable("option", "disabled"), false, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: true }); shouldnotmove('.draggable({ disabled: true })'); - el.data("disabled.draggable", false); - equals(el.data("disabled.draggable"), false, "disabled.draggable setter"); - shouldmove('.data("disabled.draggable", false)'); + el.draggable("option", "disabled", false); + equals(el.draggable("option", "disabled"), false, "disabled option setter"); + shouldmove('.draggable("option", "disabled", false)'); var expected = $('<div></div>').draggable(), actual = expected.draggable('enable'); @@ -89,15 +81,15 @@ test("disable", function() { shouldmove('.draggable({ disabled: false })'); el.draggable("disable"); shouldnotmove('.draggable("disable")'); - equals(el.data("disabled.draggable"), true, "disabled.draggable getter"); + equals(el.draggable("option", "disabled"), true, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: false }); shouldmove('.draggable({ disabled: false })'); - el.data("disabled.draggable", true); - equals(el.data("disabled.draggable"), true, "disabled.draggable setter"); - shouldnotmove('.data("disabled.draggable", true)'); + el.draggable("option", "disabled", true); + equals(el.draggable("option", "disabled"), true, "disabled option setter"); + shouldnotmove('.draggable("option", "disabled", true)'); var expected = $('<div></div>').draggable(), actual = expected.draggable('disable'); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index 51cb65e74..87b916888 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -20,16 +20,14 @@ test("init", function() { $("<div></div>").droppable().droppable("foo"); ok(true, 'arbitrary method called after init'); - $("<div></div>").droppable().data("foo.droppable"); + $("<div></div>").droppable().droppable("option", "foo"); ok(true, 'arbitrary option getter after init'); - $("<div></div>").droppable().data("foo.droppable", "bar"); + $("<div></div>").droppable().droppable("option", "foo", "bar"); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').droppable().droppable("destroy").remove(); ok(true, '.droppable("destroy") called on element'); @@ -41,12 +39,6 @@ test("destroy", function() { $("<div></div>").droppable().droppable("destroy").droppable("foo"); ok(true, 'arbitrary method called after destroy'); - - $("<div></div>").droppable().droppable("destroy").data("foo.droppable"); - ok(true, 'arbitrary option getter after destroy'); - - $("<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'); @@ -59,12 +51,12 @@ test("enable", function() { shouldNotBeDroppable(); el.droppable("enable"); shouldBeDroppable(); - equals(el.data("disabled.droppable"), false, "disabled.droppable getter"); + equals(el.droppable("option", "disabled"), false, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: true }); shouldNotBeDroppable(); - el.data("disabled.droppable", false); - equals(el.data("disabled.droppable"), false, "disabled.droppable setter"); + el.droppable("option", "disabled", false); + equals(el.droppable("option", "disabled"), false, "disabled option setter"); shouldBeDroppable(); var expected = $('<div></div>').droppable(), @@ -78,12 +70,12 @@ test("disable", function() { shouldBeDroppable(); el.droppable("disable"); shouldNotBeDroppable(); - equals(el.data("disabled.droppable"), true, "disabled.droppable getter"); + equals(el.droppable("option", "disabled"), true, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: false }); shouldBeDroppable(); - el.data("disabled.droppable", true); - equals(el.data("disabled.droppable"), true, "disabled.droppable setter"); + el.droppable("option", "disabled", true); + equals(el.droppable("option", "disabled"), true, "disabled option setter"); shouldNotBeDroppable(); var expected = $('<div></div>').droppable(), diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js index e029e00cf..6ac287fe2 100644 --- a/tests/unit/resizable/resizable_methods.js +++ b/tests/unit/resizable/resizable_methods.js @@ -21,17 +21,15 @@ test("init", function() { ok(true, 'arbitrary method called after init'); el = $('<div></div>').resizable() - var foo = el.data("foo.resizable"); + var foo = el.resizable("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); - $('<div></div>').resizable().data("foo.resizable", "bar").remove(); + $('<div></div>').resizable().resizable("option", "foo", "bar").remove(); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').resizable().resizable("destroy").remove(); ok(true, '.resizable("destroy") called on element'); @@ -44,14 +42,6 @@ test("destroy", function() { $('<div></div>').resizable().resizable("destroy").resizable("foo").remove(); ok(true, 'arbitrary method called after destroy'); - el = $('<div></div>').resizable(); - var foo = el.resizable("destroy").data("foo.resizable"); - el.remove(); - ok(true, 'arbitrary option getter after destroy'); - - $('<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'); diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js index 4d1701440..06b75f9fc 100644 --- a/tests/unit/selectable/selectable_methods.js +++ b/tests/unit/selectable/selectable_methods.js @@ -21,17 +21,15 @@ test("init", function() { ok(true, 'arbitrary method called after init'); el = $("<div></div>").selectable() - var foo = el.data("foo.selectable"); + var foo = el.selectable("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); - $("<div></div>").selectable().data("foo.selectable", "bar").remove(); + $("<div></div>").selectable().selectable("option", "foo", "bar").remove(); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').selectable().selectable("destroy").remove(); ok(true, '.selectable("destroy") called on element'); @@ -44,14 +42,6 @@ test("destroy", function() { $("<div></div>").selectable().selectable("destroy").selectable("foo").remove(); ok(true, 'arbitrary method called after destroy'); - el = $("<div></div>").selectable(); - var foo = el.selectable("destroy").data("foo.selectable"); - el.remove(); - ok(true, 'arbitrary option getter after destroy'); - - $("<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'); diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 428ca73f7..65eb4e8d5 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -21,17 +21,15 @@ test("init", function() { ok(true, 'arbitrary method called after init'); var el = $('<div></div>').slider(); - var foo = el.data("foo.slider"); + var foo = el.slider("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); - $('<div></div>').slider().data("foo.slider", "bar").remove(); + $('<div></div>').slider().slider("option", "foo", "bar").remove(); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(9); - $("<div></div>").appendTo('body').slider().slider("destroy").remove(); ok(true, '.slider("destroy") called on element'); @@ -44,22 +42,6 @@ test("destroy", function() { $('<div></div>').slider().slider("destroy").slider("foo").remove(); ok(true, 'arbitrary method called after destroy'); - var el = $('<div></div>').slider(); - var foo = el.slider("destroy").data("foo.slider"); - el.remove(); - ok(true, 'arbitrary option getter (.data) after destroy'); - - el = $('<div></div>').slider(); - var foo = el.slider("destroy").slider("option", "foo"); - el.remove(); - ok(true, 'arbitrary option getter (.slider option method) after destroy'); - - $('<div></div>').slider().slider("destroy").data("foo.slider", "bar").remove(); - ok(true, 'arbitrary option setter (.data) after destroy'); - - $('<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'); diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index 74d7be02e..adccc8c87 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -37,16 +37,14 @@ test("init", function() { $("<div></div>").sortable().sortable("foo"); ok(true, 'arbitrary method called after init'); - $("<div></div>").sortable().data("foo.sortable"); + $("<div></div>").sortable().sortable("option", "foo"); ok(true, 'arbitrary option getter after init'); - $("<div></div>").sortable().data("foo.sortable", "bar"); + $("<div></div>").sortable().sortable("option", "foo", "bar"); ok(true, 'arbitrary option setter after init'); }); test("destroy", function() { - expect(7); - $("<div></div>").appendTo('body').sortable().sortable("destroy").remove(); ok(true, '.sortable("destroy") called on element'); @@ -59,12 +57,6 @@ test("destroy", function() { $("<div></div>").sortable().sortable("destroy").sortable("foo"); ok(true, 'arbitrary method called after destroy'); - $("<div></div>").sortable().sortable("destroy").data("foo.sortable"); - ok(true, 'arbitrary option getter after destroy'); - - $("<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'); @@ -77,14 +69,14 @@ test("enable", function() { sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })'); el.sortable("enable"); - equals(el.data("disabled.sortable"), false, "disabled.sortable getter"); + equals(el.sortable("option", "disabled"), false, "disabled option getter"); el.sortable("destroy"); el.sortable({ disabled: true }); - el.data("disabled.sortable", false); - equals(el.data("disabled.sortable"), false, "disabled.sortable setter"); + el.sortable("option", "disabled", false); + equals(el.sortable("option", "disabled"), false, "disabled option setter"); - sort($("li", el)[0], 0, 40, 2, '.data("disabled.sortable", false)'); + sort($("li", el)[0], 0, 40, 2, '.sortable("option", "disabled", false)'); var expected = $('<div></div>').sortable(), actual = expected.sortable('enable'); @@ -103,9 +95,9 @@ test("disable", function() { el.sortable({ disabled: false }); sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); - 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)'); + el.sortable("option", "disabled", true); + equals(el.sortable("option", "disabled"), true, "disabled option setter"); + sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)'); var expected = $('<div></div>').sortable(), actual = expected.sortable('disable'); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index 941a7b517..b1b5462a6 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -16,7 +16,7 @@ test('init', function() { ok( $('div:eq(0)', el).is('.ui-tabs-panel.ui-widget-content.ui-corner-bottom'), 'attach classes to panel' ); ok( $('li:eq(0)', el).is('.ui-tabs-selected.ui-state-active.ui-corner-top'), 'attach classes to active li'); ok( $('li:eq(1)', el).is('.ui-state-default.ui-corner-top'), 'attach classes to inactive li'); - equals( el.data('selected.tabs'), 0, 'selected.tabs set' ); + equals( el.tabs('option', 'selected'), 0, 'selected option set' ); equals( $('li', el).index( $('li.ui-tabs-selected', el) ), 0, 'second tab active'); equals( $('div', el).index( $('div.ui-tabs-hide', '#tabs1') ), 1, 'second panel should be hidden' ); }); @@ -77,7 +77,7 @@ test('remove', function() { el.tabs('select', 1); el.tabs('remove', 1); - equals(el.data('selected.tabs'), 0, 'update selected property'); + equals(el.tabs('option', 'selected'), 0, 'update selected property'); }); test('select', function() { @@ -86,36 +86,36 @@ test('select', function() { el = $('#tabs1').tabs(); el.tabs('select', 1); - equals(el.data('selected.tabs'), 1, 'should select tab'); + equals(el.tabs('option', 'selected'), 1, 'should select tab'); el.tabs('destroy'); el.tabs({ collapsible: true }); el.tabs('select', 0); - equals(el.data('selected.tabs'), -1, 'should collapse tab passing in the already selected tab'); + equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in the already selected tab'); el.tabs('destroy'); el.tabs({ collapsible: true }); el.tabs('select', -1); - equals(el.data('selected.tabs'), -1, 'should collapse tab passing in -1'); + equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in -1'); el.tabs('destroy'); el.tabs({ collapsible: true }); el.tabs('select', null); - equals(el.data('selected.tabs'), -1, 'should collapse tab passing in null (deprecated)'); + equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in null (deprecated)'); el.tabs('select', null); - equals(el.data('selected.tabs'), -1, 'should not select tab passing in null a second time (deprecated)'); + equals(el.tabs('option', 'selected'), -1, 'should not select tab passing in null a second time (deprecated)'); el.tabs('destroy'); el.tabs(); el.tabs('select', 0); - equals(el.data('selected.tabs'), 0, 'should not collapse tab if collapsible is not set to true'); + equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true'); el.tabs('select', -1); - equals(el.data('selected.tabs'), 0, 'should not collapse tab if collapsible is not set to true'); + equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true'); el.tabs('select', null); - equals(el.data('selected.tabs'), 0, 'should not collapse tab if collapsible is not set to true'); + equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true'); el.tabs('select', '#fragment-2'); - equals(el.data('selected.tabs'), 1, 'should select tab by id'); + equals(el.tabs('option', 'selected'), 1, 'should select tab by id'); }); test('load', function() { diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index e6554f6ce..0b79f87ef 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -19,11 +19,11 @@ test('collapsible', function() { el = $('#tabs1'); el.tabs({ collapsible: true }); - equals(el.data('collapsible.tabs'), true, 'option set'); + equals(el.tabs('option', 'collapsible'), true, 'option set'); ok(el.is('.ui-tabs-collapsible'), 'extra class "ui-tabs-collapsible" attached'); el.tabs('select', 0); equals($('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden'); - el.data('collapsible.tabs', false); + el.tabs('option', 'collapsible', false); ok(el.is(':not(.ui-tabs-collapsible)'), 'extra class "ui-tabs-collapsible" not attached'); }); @@ -70,11 +70,11 @@ test('deselectable (deprecated)', function() { el = $('#tabs1'); el.tabs({ deselectable: true }); - equals(el.data('collapsible.tabs'), true, 'option set'); + equals(el.tabs('option', 'collapsible'), true, 'option set'); ok(el.is('.ui-tabs-collapsible'), 'extra class "ui-tabs-collapsible" attached'); el.tabs('select', 0); equals($('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden'); - el.data('deselectable.tabs', false); + el.tabs('option', 'deselectable', false); ok(el.is(':not(.ui-tabs-collapsible)'), 'extra class "ui-tabs-collapsible" not attached'); }); @@ -103,30 +103,30 @@ test('selected', function() { expect(8); el = $('#tabs1').tabs(); - equals(el.data('selected.tabs'), 0, 'should be 0 by default'); + equals(el.tabs('option', 'selected'), 0, 'should be 0 by default'); el.tabs('destroy'); el.tabs({ selected: -1 }); - equals(el.data('selected.tabs'), -1, 'should be -1 for all tabs unselected'); + equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected'); equals( $('li.ui-tabs-selected', el).length, 0, 'no tab should be selected' ); equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' ); el.tabs('destroy'); el.tabs({ selected: null }); - equals(el.data('selected.tabs'), -1, 'should be -1 for all tabs unselected with value null (deprecated)'); + equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected with value null (deprecated)'); el.tabs('destroy'); el.tabs({ selected: 1 }); - equals(el.data('selected.tabs'), 1, 'should be specified tab'); + equals(el.tabs('option', 'selected'), 1, 'should be specified tab'); el.tabs('destroy'); el.tabs({ selected: 99 }); - equals(el.data('selected.tabs'), 0, 'selected should default to zero if given value is out of index'); + equals(el.tabs('option', 'selected'), 0, 'selected should default to zero if given value is out of index'); el.tabs('destroy'); el.tabs({ collapsible: true }); - el.data('selected.tabs', 0); - equals(el.data('selected.tabs'), 0, 'should not collapse tab if value is same as selected'); + el.tabs('option', 'selected', 0); + equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if value is same as selected'); }); test('spinner', function() { |