diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2010-02-02 14:04:50 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2010-02-02 14:04:50 +0000 |
commit | df391a998fe3af2fe950e7c07921f70c02e8d541 (patch) | |
tree | 7b958e3bbb46ae91ca43591305deb5269e71b7ff /tests | |
parent | d549ba6d43072f65c56159a136ad4c077d859d36 (diff) | |
download | jquery-ui-df391a998fe3af2fe950e7c07921f70c02e8d541.tar.gz jquery-ui-df391a998fe3af2fe950e7c07921f70c02e8d541.zip |
Fix for #5120 - create menu only once and return that element from the widget method, put ui-autocomplete class on menu
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/autocomplete/autocomplete_events.js | 10 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_methods.js | 3 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_options.js | 8 |
3 files changed, 11 insertions, 10 deletions
diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index 88df16528..3bbcafdf2 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -24,7 +24,7 @@ test("all events", function() { }, close: function(event) { same(event.type, "autocompleteclose"); - same( $(".ui-menu").length, 1 ); + same( $(".ui-menu:visible").length, 1 ); }, select: function(event, ui) { same(event.type, "autocompleteselect"); @@ -32,13 +32,13 @@ test("all events", function() { }, change: function(event) { same(event.type, "autocompletechange"); - same( $(".ui-menu").length, 0 ); + same( $(".ui-menu:visible").length, 0 ); } }); stop(); ac.val("ja").keydown(); setTimeout(function() { - same( $(".ui-menu").length, 1 ); + same( $(".ui-menu:visible").length, 1 ); ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); start(); @@ -66,10 +66,10 @@ test("cancel search", function() { stop(); ac.val("ja").keydown(); setTimeout(function() { - same( $(".ui-menu").length, 0 ); + same( $(".ui-menu:visible").length, 0 ); ac.val("java").keydown(); setTimeout(function() { - same( $(".ui-menu").length, 1 ); + same( $(".ui-menu:visible").length, 1 ); same( $(".ui-menu .ui-menu-item").length, 2 ); start(); }, 50); diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js index 3ad93844c..44e74cb69 100644 --- a/tests/unit/autocomplete/autocomplete_methods.js +++ b/tests/unit/autocomplete/autocomplete_methods.js @@ -9,7 +9,8 @@ module("autocomplete: methods"); test("destroy", function() { var beforeHtml = $("#autocomplete").parent().html(); var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html(); - same( beforeHtml, afterHtml ); + // TODO can't use same, as that would insert the markup unescaped into the test results, screwing up other tests + ok( beforeHtml == afterHtml ); }) var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"]; diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js index 5a3a7d732..bd07ab7eb 100644 --- a/tests/unit/autocomplete/autocomplete_options.js +++ b/tests/unit/autocomplete/autocomplete_options.js @@ -71,12 +71,12 @@ test("delay", function() { }); ac.val("ja").keydown(); - same( $(".ui-menu").length, 0 ); + same( $(".ui-menu:visible").length, 0 ); // wait half a second for the default delay to open the menu stop(); setTimeout(function() { - same( $(".ui-menu").length, 1 ); + same( $(".ui-menu:visible").length, 1 ); ac.autocomplete("destroy"); start(); }, 100); @@ -87,11 +87,11 @@ test("minLength", function() { source: data }); ac.autocomplete("search", ""); - same( $(".ui-menu").length, 0, "blank not enough for minLength: 1" ); + same( $(".ui-menu:visible").length, 0, "blank not enough for minLength: 1" ); ac.autocomplete("option", "minLength", 0); ac.autocomplete("search", ""); - same( $(".ui-menu").length, 1, "blank enough for minLength: 0" ); + same( $(".ui-menu:visible").length, 1, "blank enough for minLength: 0" ); ac.autocomplete("destroy"); }); |