mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Selectmenu tests: improve focus event test so its possible to test for too much focus events from menu widget
This commit is contained in:
parent
20aad07fe4
commit
812a90fc82
@ -46,27 +46,28 @@ test("close", function () {
|
|||||||
test("focus", function () {
|
test("focus", function () {
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var counter = 0,
|
var button,
|
||||||
button,
|
menu,
|
||||||
menu;
|
links;
|
||||||
|
|
||||||
this.element.selectmenu({
|
this.element.selectmenu({
|
||||||
focus: function (event, ui) {
|
focus: function (event, ui) {
|
||||||
counter++;
|
ok(event, "focus event fired on mouseover");
|
||||||
if (counter === 1) {
|
equal(event.type, "selectmenufocus", "event type set to selectmenufocus");
|
||||||
ok(event, "focus event fired on mouseover");
|
ok(ui, "ui object is passed as second argument to event handler");
|
||||||
equal(event.type, "selectmenufocus", "event type set to selectmenufocus");
|
equal(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
|
||||||
ok(ui, "ui object is passed as second argument to event handler");
|
|
||||||
equal(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
button = this.element.selectmenu("widget"),
|
||||||
|
menu = this.element.selectmenu("menuWidget");
|
||||||
|
|
||||||
button = this.element.selectmenu("widget").parent();
|
button.simulate( "focus" );
|
||||||
menu = this.element.selectmenu("menuWidget").parent();
|
links = menu.find("li.ui-menu-item a");
|
||||||
|
|
||||||
button.find("a").simulate( "focus" ).simulate( "click" );
|
button.simulate( "click" );
|
||||||
menu.find(".ui-menu-item").simulate("mouseover");
|
|
||||||
|
menu.find("a").last().simulate( "mouseover" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user