aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-02-24 10:50:08 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-02-24 11:14:19 +0100
commit6bd95efe5e1a6f013a1efee73f9ce468013c2c35 (patch)
tree70b0c17e88b49c59782fc49919c18e063a0e0be0 /tests
parent5d3f91bcbef40832e6eb45a6b4f519353fbe2529 (diff)
downloadjquery-ui-6bd95efe5e1a6f013a1efee73f9ce468013c2c35.tar.gz
jquery-ui-6bd95efe5e1a6f013a1efee73f9ce468013c2c35.zip
Menu: Fix filter matching to work with flyout menu
Diffstat (limited to 'tests')
-rw-r--r--tests/visual/menu/flyoutmenu.js41
1 files changed, 2 insertions, 39 deletions
diff --git a/tests/visual/menu/flyoutmenu.js b/tests/visual/menu/flyoutmenu.js
index 6fb522680..1e968dd61 100644
--- a/tests/visual/menu/flyoutmenu.js
+++ b/tests/visual/menu/flyoutmenu.js
@@ -47,53 +47,16 @@ $.widget("ui.flyoutmenu", {
case $.ui.keyCode.RIGHT:
if (self.right(event)) {
event.stopImmediatePropagation();
- }
+ }
event.preventDefault();
break;
case $.ui.keyCode.ESCAPE:
self.hide();
break;
- default:
- clearTimeout(self.filterTimer);
- var prev = self.previousFilter || "";
- var character = String.fromCharCode(event.keyCode);
- var skip = false;
- if (character == prev) {
- skip = true;
- } else {
- character = prev + character;
- }
- function escape(value) {
- return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- }
- var match = self.activeItem.parent("ul").children("li").filter(function() {
- // TODO why filter child anchor here, but not in the filter below?
- return new RegExp("^" + escape(character), "i").test($("a", this).text());
- });
- var match = skip && match.index(self.active.next()) != -1 ? match.next() : match;
- if (!match.length) {
- character = String.fromCharCode(event.keyCode);
- // TODO why use self.widget() here instead of self.activeItem??
- match = self.widget().children("li").filter(function() {
- return new RegExp("^" + escape(character), "i").test($(this).text());
- });
- }
- if (match.length) {
- self.activate(event, match);
- if (match.length > 1) {
- self.previousFilter = character;
- self.filterTimer = setTimeout(function() {
- delete self.previousFilter;
- }, 1000);
- } else {
- delete self.previousFilter;
- }
- } else {
- delete self.previousFilter;
- }
}
});
},
+
_open: function(submenu) {
// TODO restrict to widget
//only one menu can have items open at a time.