aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu/selectmenu_options.js
blob: 993086b2728cf2488dfeee329ab1c8cdcef7a01c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(function ($) {

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(4);
	
	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 dropdown");		
	ok( ul.hasClass("ui-corner-bottom") && !ul.hasClass("ui-corner-all"), "menu styles dropdown");		
	
	this.element.selectmenu("close");
	this.element.selectmenu("option", "dropdown", false);
	this.element.selectmenu("open");
	ok( !link.hasClass("ui-corner-top") && link.hasClass("ui-corner-all"), "button styles pop-up");		
	ok( !ul.hasClass("ui-corner-bottom") && ul.hasClass("ui-corner-all"), "menu styles pop-up");		
});

})(jQuery);