aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-12-12 18:37:57 +0100
committerFelix Nagel <info@felixnagel.com>2012-12-12 19:30:45 +0100
commit812a90fc8221a1dd2fa79543917e765f1929c71e (patch)
treea41c9de7aeb3fd1cc7c6b9814d78b55f993c7afc /tests/unit/selectmenu
parent20aad07fe4e6bf625b23d90cc6689294a304bf52 (diff)
downloadjquery-ui-812a90fc8221a1dd2fa79543917e765f1929c71e.tar.gz
jquery-ui-812a90fc8221a1dd2fa79543917e765f1929c71e.zip
Selectmenu tests: improve focus event test so its possible to test for too much focus events from menu widget
Diffstat (limited to 'tests/unit/selectmenu')
-rw-r--r--tests/unit/selectmenu/selectmenu_events.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/unit/selectmenu/selectmenu_events.js b/tests/unit/selectmenu/selectmenu_events.js
index eb15fea0a..167a6695f 100644
--- a/tests/unit/selectmenu/selectmenu_events.js
+++ b/tests/unit/selectmenu/selectmenu_events.js
@@ -46,27 +46,28 @@ test("close", function () {
test("focus", function () {
expect(4);
- var counter = 0,
- button,
- menu;
+ var button,
+ menu,
+ links;
this.element.selectmenu({
focus: function (event, ui) {
- counter++;
- if (counter === 1) {
- ok(event, "focus event fired on mouseover");
- equal(event.type, "selectmenufocus", "event type set to selectmenufocus");
- 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");
- }
+ ok(event, "focus event fired on mouseover");
+ equal(event.type, "selectmenufocus", "event type set to selectmenufocus");
+ 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").parent();
- menu = this.element.selectmenu("menuWidget").parent();
-
- button.find("a").simulate( "focus" ).simulate( "click" );
- menu.find(".ui-menu-item").simulate("mouseover");
+
+ button = this.element.selectmenu("widget"),
+ menu = this.element.selectmenu("menuWidget");
+
+ button.simulate( "focus" );
+ links = menu.find("li.ui-menu-item a");
+
+ button.simulate( "click" );
+
+ menu.find("a").last().simulate( "mouseover" );
});