diff options
author | Richard Worth <rdworth@gmail.com> | 2010-01-20 14:00:14 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2010-01-20 14:00:14 +0000 |
commit | eecbde22a6b338785ac8e1991858ba7dab976eae (patch) | |
tree | 11c5e0835757497110151e803bb1e1fb39820dcc /tests/unit/autocomplete | |
parent | a1e069759ddcd3e56deff0d9334559b156df734c (diff) | |
download | jquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.tar.gz jquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.zip |
eol-style and mime-type
Diffstat (limited to 'tests/unit/autocomplete')
-rw-r--r-- | tests/unit/autocomplete/autocomplete.html | 70 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_core.js | 78 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_defaults.js | 24 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_events.js | 240 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_methods.js | 70 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_options.js | 348 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_tickets.js | 20 |
7 files changed, 425 insertions, 425 deletions
diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html index 5d87a0a61..36f539717 100644 --- a/tests/unit/autocomplete/autocomplete.html +++ b/tests/unit/autocomplete/autocomplete.html @@ -1,35 +1,35 @@ -<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Autocomplete Test Suite</title>
-
- <script type="text/javascript" src="../../../jquery-1.4.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.menu.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
-
- <link type="text/css" href="../testsuite.css" rel="stylesheet" />
- <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
- <script type="text/javascript" src="../../jquery.simulate.js"></script>
- <script type="text/javascript" src="../testsuite.js"></script>
-
- <script type="text/javascript" src="autocomplete_core.js"></script>
- <script type="text/javascript" src="autocomplete_defaults.js"></script>
- <script type="text/javascript" src="autocomplete_events.js"></script>
- <script type="text/javascript" src="autocomplete_methods.js"></script>
- <script type="text/javascript" src="autocomplete_options.js"></script>
- <script type="text/javascript" src="autocomplete_tickets.js"></script>
-
-</head>
-<body>
-
-<div id="main">
-
- <div><input id="autocomplete" class="foo" /></div>
-
-</div>
-
-</body>
-</html>
+<!doctype html> +<html lang="en"> +<head> + <title>jQuery UI Autocomplete Test Suite</title> + + <script type="text/javascript" src="../../../jquery-1.4.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.menu.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script> + + <link type="text/css" href="../testsuite.css" rel="stylesheet" /> + <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script> + <script type="text/javascript" src="../../jquery.simulate.js"></script> + <script type="text/javascript" src="../testsuite.js"></script> + + <script type="text/javascript" src="autocomplete_core.js"></script> + <script type="text/javascript" src="autocomplete_defaults.js"></script> + <script type="text/javascript" src="autocomplete_events.js"></script> + <script type="text/javascript" src="autocomplete_methods.js"></script> + <script type="text/javascript" src="autocomplete_options.js"></script> + <script type="text/javascript" src="autocomplete_tickets.js"></script> + +</head> +<body> + +<div id="main"> + + <div><input id="autocomplete" class="foo" /></div> + +</div> + +</body> +</html> diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js index 6c5cccfe4..6d8b2f903 100644 --- a/tests/unit/autocomplete/autocomplete_core.js +++ b/tests/unit/autocomplete/autocomplete_core.js @@ -1,39 +1,39 @@ -/*
- * autocomplete_core.js
- */
-
-
-(function($) {
-
-module("autocomplete: core");
-
-test("close-on-blur is properly delayed", function() {
- var ac = $("#autocomplete").autocomplete({
- source: ["java", "javascript"]
- }).val("ja").autocomplete("search");
- same( $(".ui-menu:visible").length, 1 );
- ac.blur();
- same( $(".ui-menu:visible").length, 1 );
- stop();
- setTimeout(function() {
- same( $(".ui-menu:visible").length, 0 );
- start();
- }, 200);
-})
-
-test("close-on-blur is cancelled when starting a search", function() {
- var ac = $("#autocomplete").autocomplete({
- source: ["java", "javascript"]
- }).val("ja").autocomplete("search");
- same( $(".ui-menu:visible").length, 1 );
- ac.blur();
- same( $(".ui-menu:visible").length, 1 );
- ac.autocomplete("search");
- stop();
- setTimeout(function() {
- same( $(".ui-menu:visible").length, 1 );
- start();
- }, 200);
-})
-
-})(jQuery);
+/* + * autocomplete_core.js + */ + + +(function($) { + +module("autocomplete: core"); + +test("close-on-blur is properly delayed", function() { + var ac = $("#autocomplete").autocomplete({ + source: ["java", "javascript"] + }).val("ja").autocomplete("search"); + same( $(".ui-menu:visible").length, 1 ); + ac.blur(); + same( $(".ui-menu:visible").length, 1 ); + stop(); + setTimeout(function() { + same( $(".ui-menu:visible").length, 0 ); + start(); + }, 200); +}) + +test("close-on-blur is cancelled when starting a search", function() { + var ac = $("#autocomplete").autocomplete({ + source: ["java", "javascript"] + }).val("ja").autocomplete("search"); + same( $(".ui-menu:visible").length, 1 ); + ac.blur(); + same( $(".ui-menu:visible").length, 1 ); + ac.autocomplete("search"); + stop(); + setTimeout(function() { + same( $(".ui-menu:visible").length, 1 ); + start(); + }, 200); +}) + +})(jQuery); diff --git a/tests/unit/autocomplete/autocomplete_defaults.js b/tests/unit/autocomplete/autocomplete_defaults.js index dc941b9e4..c6017d62c 100644 --- a/tests/unit/autocomplete/autocomplete_defaults.js +++ b/tests/unit/autocomplete/autocomplete_defaults.js @@ -1,12 +1,12 @@ -/*
- * autocomplete_defaults.js
- */
-
-var autocomplete_defaults = {
- delay: 300,
- disabled: false,
- minLength: 1,
- source: undefined
-};
-
-commonWidgetTests('autocomplete', { defaults: autocomplete_defaults });
+/* + * autocomplete_defaults.js + */ + +var autocomplete_defaults = { + delay: 300, + disabled: false, + minLength: 1, + source: undefined +}; + +commonWidgetTests('autocomplete', { defaults: autocomplete_defaults }); diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index 09dd2ef11..88df16528 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -1,120 +1,120 @@ -/*
- * autocomplete_events.js
- */
-(function($) {
-
-module("autocomplete: events");
-
-var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"];
-
-test("all events", function() {
- expect(11);
- var ac = $("#autocomplete").autocomplete({
- delay: 0,
- source: data,
- search: function(event) {
- same(event.type, "autocompletesearch");
- },
- open: function(event) {
- same(event.type, "autocompleteopen");
- },
- focus: function(event, ui) {
- same(event.type, "autocompletefocus");
- same(ui.item, {label:"java", value:"java"});
- },
- close: function(event) {
- same(event.type, "autocompleteclose");
- same( $(".ui-menu").length, 1 );
- },
- select: function(event, ui) {
- same(event.type, "autocompleteselect");
- same(ui.item, {label:"java", value:"java"});
- },
- change: function(event) {
- same(event.type, "autocompletechange");
- same( $(".ui-menu").length, 0 );
- }
- });
- stop();
- ac.val("ja").keydown();
- setTimeout(function() {
- same( $(".ui-menu").length, 1 );
- ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN });
- ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER });
- start();
- }, 50);
-});
-
-test("cancel search", function() {
- expect(6);
- var first = true;
- var ac = $("#autocomplete").autocomplete({
- delay: 0,
- source: data,
- search: function() {
- if (first) {
- same( ac.val(), "ja" );
- first = false;
- return false;
- }
- same( ac.val(), "java" );
- },
- open: function() {
- ok(true);
- }
- });
- stop();
- ac.val("ja").keydown();
- setTimeout(function() {
- same( $(".ui-menu").length, 0 );
- ac.val("java").keydown();
- setTimeout(function() {
- same( $(".ui-menu").length, 1 );
- same( $(".ui-menu .ui-menu-item").length, 2 );
- start();
- }, 50);
- }, 50);
-});
-
-test("cancel focus", function() {
- expect(1);
- var customVal = 'custom value';
- var ac = $("#autocomplete").autocomplete({
- delay: 0,
- source: data,
- focus: function(event, ui) {
- $(this).val(customVal);
- return false;
- }
- });
- stop();
- ac.val("ja").keydown();
- setTimeout(function() {
- ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN });
- same( ac.val(), customVal );
- start();
- }, 50);
-});
-
-test("cancel select", function() {
- expect(1);
- var customVal = 'custom value';
- var ac = $("#autocomplete").autocomplete({
- delay: 0,
- source: data,
- select: function(event, ui) {
- $(this).val(customVal);
- return false;
- }
- });
- stop();
- ac.val("ja").keydown();
- setTimeout(function() {
- ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN });
- ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER });
- same( ac.val(), customVal );
- start();
- }, 50);
-});
-
-})(jQuery);
+/* + * autocomplete_events.js + */ +(function($) { + +module("autocomplete: events"); + +var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"]; + +test("all events", function() { + expect(11); + var ac = $("#autocomplete").autocomplete({ + delay: 0, + source: data, + search: function(event) { + same(event.type, "autocompletesearch"); + }, + open: function(event) { + same(event.type, "autocompleteopen"); + }, + focus: function(event, ui) { + same(event.type, "autocompletefocus"); + same(ui.item, {label:"java", value:"java"}); + }, + close: function(event) { + same(event.type, "autocompleteclose"); + same( $(".ui-menu").length, 1 ); + }, + select: function(event, ui) { + same(event.type, "autocompleteselect"); + same(ui.item, {label:"java", value:"java"}); + }, + change: function(event) { + same(event.type, "autocompletechange"); + same( $(".ui-menu").length, 0 ); + } + }); + stop(); + ac.val("ja").keydown(); + setTimeout(function() { + same( $(".ui-menu").length, 1 ); + ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); + ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); + start(); + }, 50); +}); + +test("cancel search", function() { + expect(6); + var first = true; + var ac = $("#autocomplete").autocomplete({ + delay: 0, + source: data, + search: function() { + if (first) { + same( ac.val(), "ja" ); + first = false; + return false; + } + same( ac.val(), "java" ); + }, + open: function() { + ok(true); + } + }); + stop(); + ac.val("ja").keydown(); + setTimeout(function() { + same( $(".ui-menu").length, 0 ); + ac.val("java").keydown(); + setTimeout(function() { + same( $(".ui-menu").length, 1 ); + same( $(".ui-menu .ui-menu-item").length, 2 ); + start(); + }, 50); + }, 50); +}); + +test("cancel focus", function() { + expect(1); + var customVal = 'custom value'; + var ac = $("#autocomplete").autocomplete({ + delay: 0, + source: data, + focus: function(event, ui) { + $(this).val(customVal); + return false; + } + }); + stop(); + ac.val("ja").keydown(); + setTimeout(function() { + ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); + same( ac.val(), customVal ); + start(); + }, 50); +}); + +test("cancel select", function() { + expect(1); + var customVal = 'custom value'; + var ac = $("#autocomplete").autocomplete({ + delay: 0, + source: data, + select: function(event, ui) { + $(this).val(customVal); + return false; + } + }); + stop(); + ac.val("ja").keydown(); + setTimeout(function() { + ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); + ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); + same( ac.val(), customVal ); + start(); + }, 50); +}); + +})(jQuery); diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js index 61cf2a33c..3ad93844c 100644 --- a/tests/unit/autocomplete/autocomplete_methods.js +++ b/tests/unit/autocomplete/autocomplete_methods.js @@ -1,35 +1,35 @@ -/*
- * autocomplete_methods.js
- */
-(function($) {
-
-
-module("autocomplete: methods");
-
-test("destroy", function() {
- var beforeHtml = $("#autocomplete").parent().html();
- var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html();
- same( beforeHtml, afterHtml );
-})
-
-var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"];
-
-test("search", function() {
- var ac = $("#autocomplete").autocomplete({
- source: data,
- minLength: 0
- });
- ac.autocomplete("search");
- same( $(".ui-menu .ui-menu-item").length, data.length, "all items for a blank search" );
-
- ac.val("has");
- ac.autocomplete("search")
- same( $(".ui-menu .ui-menu-item").text(), "haskell", "only one item for set input value" );
-
- ac.autocomplete("search", "ja");
- same( $(".ui-menu .ui-menu-item").length, 2, "only java and javascript for 'ja'" );
-
- $("#autocomplete").autocomplete("destroy");
-})
-
-})(jQuery);
+/* + * autocomplete_methods.js + */ +(function($) { + + +module("autocomplete: methods"); + +test("destroy", function() { + var beforeHtml = $("#autocomplete").parent().html(); + var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html(); + same( beforeHtml, afterHtml ); +}) + +var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"]; + +test("search", function() { + var ac = $("#autocomplete").autocomplete({ + source: data, + minLength: 0 + }); + ac.autocomplete("search"); + same( $(".ui-menu .ui-menu-item").length, data.length, "all items for a blank search" ); + + ac.val("has"); + ac.autocomplete("search") + same( $(".ui-menu .ui-menu-item").text(), "haskell", "only one item for set input value" ); + + ac.autocomplete("search", "ja"); + same( $(".ui-menu .ui-menu-item").length, 2, "only java and javascript for 'ja'" ); + + $("#autocomplete").autocomplete("destroy"); +}) + +})(jQuery); diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js index 1b6857b22..5a3a7d732 100644 --- a/tests/unit/autocomplete/autocomplete_options.js +++ b/tests/unit/autocomplete/autocomplete_options.js @@ -1,174 +1,174 @@ -/*
- * autocomplete_options.js
- */
-(function($) {
-
-module("autocomplete: options");
-
-
-/* disabled until autocomplete actually has built-in support for caching
-// returns at most 4 items
-function source(request) {
- ok(true, "handling a request");
- switch(request.term) {
- case "cha":
- return ["Common Pochard", "Common Chiffchaff", "Common Chaffinch", "Iberian Chiffchaff"]
- case "chaf":
- case "chaff":
- return ["Common Chiffchaff", "Common Chaffinch", "Iberian Chiffchaff"]
- case "chaffi":
- return ["Common Chaffinch"]
- case "schi":
- return ["schifpre"]
- }
-}
-
-function search(input) {
- var autocomplete = input.data("autocomplete");
- autocomplete.search("cha");
- autocomplete.close();
- autocomplete.search("chaf");
- autocomplete.close();
- autocomplete.search("chaff");
- autocomplete.close();
- autocomplete.search("chaffi");
- autocomplete.close();
- autocomplete.search("schi");
-}
-
-test("cache: default", function() {
- expect(2);
- search($("#autocomplete").autocomplete({
- source: source
- }));
-});
-
-test("cache: {limit:4}", function() {
- expect(3);
- search($("#autocomplete").autocomplete({
- cache: {
- limit: 4
- },
- source: source
- }));
-});
-
-test("cache: false", function() {
- expect(5);
- search($("#autocomplete").autocomplete({
- cache: false,
- source: source
- }));
-});
-*/
-
-var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"];
-
-test("delay", function() {
- var ac = $("#autocomplete").autocomplete({
- source: data,
- delay: 50
- });
- ac.val("ja").keydown();
-
- same( $(".ui-menu").length, 0 );
-
- // wait half a second for the default delay to open the menu
- stop();
- setTimeout(function() {
- same( $(".ui-menu").length, 1 );
- ac.autocomplete("destroy");
- start();
- }, 100);
-});
-
-test("minLength", function() {
- var ac = $("#autocomplete").autocomplete({
- source: data
- });
- ac.autocomplete("search", "");
- same( $(".ui-menu").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" );
- ac.autocomplete("destroy");
-});
-
-test("source, local string array", function() {
- var ac = $("#autocomplete").autocomplete({
- source: data
- });
- ac.val("ja").autocomplete("search");
- same( $(".ui-menu .ui-menu-item").text(), "javajavascript" );
- ac.autocomplete("destroy");
-});
-
-function source_test(source, async) {
- var ac = $("#autocomplete").autocomplete({
- source: source
- });
- ac.val("ja").autocomplete("search");
- function result(){
- same( $(".ui-menu .ui-menu-item").text(), "javajavascript" );
- ac.autocomplete("destroy");
- async && start();
- }
- if (async) {
- stop();
- setTimeout(result, 100);
- } else {
- result();
- }
-}
-
-test("source, local object array, only label property", function() {
- source_test([
- {label:"java"},
- {label:"php"},
- {label:"coldfusion"},
- {label:"javascript"}
- ]);
-});
-
-test("source, local object array, only value property", function() {
- source_test([
- {value:"java"},
- {value:"php"},
- {value:"coldfusion"},
- {value:"javascript"}
- ]);
-});
-
-test("source, url string with remote json string array", function() {
- source_test("remote_string_array.txt", true);
-});
-
-test("source, url string with remote json object array, only value properties", function() {
- source_test("remote_object_array_values.txt", true);
-});
-
-test("source, url string with remote json object array, only label properties", function() {
- source_test("remote_object_array_labels.txt", true);
-});
-
-test("source, custom", function() {
- source_test(function(request, response) {
- same( request.term, "ja" );
- response(["java", "javascript"]);
- });
-});
-
-test("source, update after init", function() {
- var ac = $("#autocomplete").autocomplete({
- source: ["java", "javascript", "haskell"]
- });
- ac.val("ja").autocomplete("search");
- same( $(".ui-menu .ui-menu-item").text(), "javajavascript" );
- ac.autocomplete("option", "source", ["php", "asp"]);
- ac.val("ph").autocomplete("search");
- same( $(".ui-menu .ui-menu-item").text(), "php" );
- ac.autocomplete("destroy");
-});
-
-})(jQuery);
+/* + * autocomplete_options.js + */ +(function($) { + +module("autocomplete: options"); + + +/* disabled until autocomplete actually has built-in support for caching +// returns at most 4 items +function source(request) { + ok(true, "handling a request"); + switch(request.term) { + case "cha": + return ["Common Pochard", "Common Chiffchaff", "Common Chaffinch", "Iberian Chiffchaff"] + case "chaf": + case "chaff": + return ["Common Chiffchaff", "Common Chaffinch", "Iberian Chiffchaff"] + case "chaffi": + return ["Common Chaffinch"] + case "schi": + return ["schifpre"] + } +} + +function search(input) { + var autocomplete = input.data("autocomplete"); + autocomplete.search("cha"); + autocomplete.close(); + autocomplete.search("chaf"); + autocomplete.close(); + autocomplete.search("chaff"); + autocomplete.close(); + autocomplete.search("chaffi"); + autocomplete.close(); + autocomplete.search("schi"); +} + +test("cache: default", function() { + expect(2); + search($("#autocomplete").autocomplete({ + source: source + })); +}); + +test("cache: {limit:4}", function() { + expect(3); + search($("#autocomplete").autocomplete({ + cache: { + limit: 4 + }, + source: source + })); +}); + +test("cache: false", function() { + expect(5); + search($("#autocomplete").autocomplete({ + cache: false, + source: source + })); +}); +*/ + +var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"]; + +test("delay", function() { + var ac = $("#autocomplete").autocomplete({ + source: data, + delay: 50 + }); + ac.val("ja").keydown(); + + same( $(".ui-menu").length, 0 ); + + // wait half a second for the default delay to open the menu + stop(); + setTimeout(function() { + same( $(".ui-menu").length, 1 ); + ac.autocomplete("destroy"); + start(); + }, 100); +}); + +test("minLength", function() { + var ac = $("#autocomplete").autocomplete({ + source: data + }); + ac.autocomplete("search", ""); + same( $(".ui-menu").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" ); + ac.autocomplete("destroy"); +}); + +test("source, local string array", function() { + var ac = $("#autocomplete").autocomplete({ + source: data + }); + ac.val("ja").autocomplete("search"); + same( $(".ui-menu .ui-menu-item").text(), "javajavascript" ); + ac.autocomplete("destroy"); +}); + +function source_test(source, async) { + var ac = $("#autocomplete").autocomplete({ + source: source + }); + ac.val("ja").autocomplete("search"); + function result(){ + same( $(".ui-menu .ui-menu-item").text(), "javajavascript" ); + ac.autocomplete("destroy"); + async && start(); + } + if (async) { + stop(); + setTimeout(result, 100); + } else { + result(); + } +} + +test("source, local object array, only label property", function() { + source_test([ + {label:"java"}, + {label:"php"}, + {label:"coldfusion"}, + {label:"javascript"} + ]); +}); + +test("source, local object array, only value property", function() { + source_test([ + {value:"java"}, + {value:"php"}, + {value:"coldfusion"}, + {value:"javascript"} + ]); +}); + +test("source, url string with remote json string array", function() { + source_test("remote_string_array.txt", true); +}); + +test("source, url string with remote json object array, only value properties", function() { + source_test("remote_object_array_values.txt", true); +}); + +test("source, url string with remote json object array, only label properties", function() { + source_test("remote_object_array_labels.txt", true); +}); + +test("source, custom", function() { + source_test(function(request, response) { + same( request.term, "ja" ); + response(["java", "javascript"]); + }); +}); + +test("source, update after init", function() { + var ac = $("#autocomplete").autocomplete({ + source: ["java", "javascript", "haskell"] + }); + ac.val("ja").autocomplete("search"); + same( $(".ui-menu .ui-menu-item").text(), "javajavascript" ); + ac.autocomplete("option", "source", ["php", "asp"]); + ac.val("ph").autocomplete("search"); + same( $(".ui-menu .ui-menu-item").text(), "php" ); + ac.autocomplete("destroy"); +}); + +})(jQuery); diff --git a/tests/unit/autocomplete/autocomplete_tickets.js b/tests/unit/autocomplete/autocomplete_tickets.js index 78f57418d..a67ff7566 100644 --- a/tests/unit/autocomplete/autocomplete_tickets.js +++ b/tests/unit/autocomplete/autocomplete_tickets.js @@ -1,10 +1,10 @@ -/*
- * autocomplete_tickets.js
- */
-(function($) {
-
-module("autocomplete: tickets");
-
-
-
-})(jQuery);
+/* + * autocomplete_tickets.js + */ +(function($) { + +module("autocomplete: tickets"); + + + +})(jQuery); |