diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-01-14 17:23:11 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-01-14 17:23:11 +0000 |
commit | 6024fdf2564b274af2f2d306f420e44a2c88d7b1 (patch) | |
tree | e2bace3eacb81bd9732226fc19dfd5089d19fe3f /tests/visual | |
parent | 7f5fe2f2f14406a0c028e92ab6203ae0b72a1e96 (diff) | |
download | jquery-ui-6024fdf2564b274af2f2d306f420e44a2c88d7b1.tar.gz jquery-ui-6024fdf2564b274af2f2d306f420e44a2c88d7b1.zip |
Copied autocomplete from dev branch.
Diffstat (limited to 'tests/visual')
-rw-r--r-- | tests/visual/autocomplete/default.html | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/visual/autocomplete/default.html b/tests/visual/autocomplete/default.html new file mode 100644 index 000000000..32b8db04e --- /dev/null +++ b/tests/visual/autocomplete/default.html @@ -0,0 +1,70 @@ +<!doctype html> +<html> +<head> + <title>Autocomplete Visual Test: Default</title> + <link rel="stylesheet" href="../visual.css" type="text/css" /> + <link rel="stylesheet" href="../../../themes/base/ui.base.css" type="text/css" /> + <link rel="stylesheet" href="../../../themes/base/ui.theme.css" type="text/css" title="ui-theme" /> + <script type="text/javascript" src="../../../jquery-1.3.2.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script> + <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script> + <script type="text/javascript"> + $(function() { + $.fn.themeswitcher && $('<div/>').css({ + position: "absolute", + right: 10, + top: 10 + }).appendTo(document.body).themeswitcher(); + + function log(message) { + $("<div/>").text(message).prependTo("#log"); + $("#log").attr("scrollTop", 0); + } + + function enable() { + $("#tags").autocomplete({ + source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"], + delay: 0, + search: function() { + log("Searching for: " + this.value); + }, + open: function() { + log("Found something"); + }, + focus: function(event, ui) { + log("Moving focus to " + ui.item.label); + }, + close: function() { + log("Hiding suggestions"); + }, + change: function(event, ui) { + log(ui.item ? ("Selected: " + ui.item.value) : "Nothing selected, input was " + this.value); + } + }); + } + enable(); + $("#toggle").toggle(function() { + $("#tags").autocomplete("destroy"); + }, enable); + }); + </script> +</head> +<body> + +<div class="ui-widget"> + <label for="tags">Tags: </label> + <input class="ui-widget ui-widget-content ui-corner-all" id="tags" /> +</div> + +<div class="ui-widget" style="margin-top:2em; font-family:Arial"> + Log: + <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div> +</div> + +<button id="toggle">Toggle widget</button> + +</body> +</html> |