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');
});
$('<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');
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');
$('<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');
}
};
- 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");
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();
});
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();
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();
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();
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();
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();
});
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();
});
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();
});
$("<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');
$("<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');
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');
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');
$("<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');
$("<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');
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(),
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(),
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');
$('<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');
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');
$("<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');
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');
$('<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');
$("<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');
$("<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');
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');
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');
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' );
});
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() {
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() {
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');
});
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');
});
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() {