diff options
author | Felix Nagel <info@felixnagel.com> | 2012-01-13 19:49:42 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-01-13 19:49:42 +0100 |
commit | 5766261af2767862ab6750e5eb8d6a927ced50ae (patch) | |
tree | 669ae6a69074c59a53e84a33cebd94ddf4d5d531 /tests/unit/selectmenu/selectmenu_options.js | |
parent | 6c049f2f9a6716a81ea7e0f9ee67362e61c397cb (diff) | |
download | jquery-ui-5766261af2767862ab6750e5eb8d6a927ced50ae.tar.gz jquery-ui-5766261af2767862ab6750e5eb8d6a927ced50ae.zip |
Selectmenu: fix unit tests (with clean-up)
Diffstat (limited to 'tests/unit/selectmenu/selectmenu_options.js')
-rw-r--r-- | tests/unit/selectmenu/selectmenu_options.js | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js index 9fd053673..804a8bee2 100644 --- a/tests/unit/selectmenu/selectmenu_options.js +++ b/tests/unit/selectmenu/selectmenu_options.js @@ -1,36 +1,31 @@ (function ($) { - module("selectmenu: options", { - setup: function () { - this.element = $("#speed"); - this.element.selectmenu(); - } - }); - - test("appendTo another element", function () { - expect(2); - - ok(this.element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector"); - ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element"); - }); - - test("dropdown", function () { - expect(2); - - var button = $("#speed-button"), - widget = this.element.selectmenu("widget"), - buttonPos = { - l: button.offset().top, - t: button.offset().left - }, - menuPos = { - l: widget.offset().top, - t: widget.offset().left - }; - - equals(menuPos.t, buttonPos.t, "menu positioned below button in dropdown mode"); //button has no height - - ok(this.element.selectmenu("option", "dropdown", false), "accepts false"); - }); +module("selectmenu: options", { + setup: function () { + this.element = $("#speed").selectmenu(); + } +}); + +test("appendTo another element", function () { + expect(2); + + ok(this.element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector"); + ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element"); +}); + +test("dropdown: CSS styles", function () { + expect(2); + + var widget = this.element.selectmenu("widget"), + button = widget.filter(".ui-selectmenu-button"), + link = button.find("a"), + menu = widget.filter(".ui-selectmenu-menu"), + ul = widget.find("ul"); + + this.element.selectmenu("open"); + + ok( link.hasClass("ui-corner-top") && !link.hasClass("ui-corner-all"), "button styles"); + ok( ul.hasClass("ui-corner-bottom") && !ul.hasClass("ui-corner-all"), "menu styles"); +}); })(jQuery); |