mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: updated options and events unit tests
This commit is contained in:
parent
041de0716c
commit
c1c0827c67
@ -14,16 +14,16 @@
|
||||
ok(event, "change event fired on change");
|
||||
equals(event.type, "selectmenuchange", "event type set to selectmenuchange");
|
||||
ok(ui, "ui object is passed as second argument to event handler");
|
||||
equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
|
||||
equals(ui.item.element[0].nodeName, "OPTION", "ui.item.element[0] points to original option element");
|
||||
equals(ui.item.value, value, "ui.item.value property updated correctly");
|
||||
}
|
||||
});
|
||||
|
||||
var widget = this.element.selectmenu("widget"),
|
||||
menu = widget.filter(".ui-selectmenu-menu");
|
||||
menu = widget.filter(".ui-selectmenu-menu"),
|
||||
value = this.element.find("option").eq(0).text();
|
||||
|
||||
menu.find(".ui-menu-item").eq(0).simulate("click");
|
||||
|
||||
equals(this.element.selectmenu("option", "value"), "Slower", "should be set to first option");
|
||||
});
|
||||
|
||||
test("close", function () {
|
||||
|
@ -14,8 +14,21 @@
|
||||
ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element");
|
||||
});
|
||||
|
||||
test("dropdown false", function () {
|
||||
expect(1);
|
||||
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");
|
||||
});
|
||||
@ -23,9 +36,11 @@
|
||||
test("value option", function () {
|
||||
expect(1);
|
||||
|
||||
this.element.selectmenu("option", "value", "jQuery UI");
|
||||
var value = this.element.find("option").eq(0).text();
|
||||
|
||||
equals(this.element.selectmenu("option", "value"), "jQuery UI", "should be set to 'jQuery UI'");
|
||||
this.element.selectmenu("option", "value", value);
|
||||
|
||||
equals(this.element.selectmenu("option", "value"), value, "should be set to " + value);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
Loading…
Reference in New Issue
Block a user