aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2010-01-20 14:00:14 +0000
committerRichard Worth <rdworth@gmail.com>2010-01-20 14:00:14 +0000
commiteecbde22a6b338785ac8e1991858ba7dab976eae (patch)
tree11c5e0835757497110151e803bb1e1fb39820dcc /tests/unit
parenta1e069759ddcd3e56deff0d9334559b156df734c (diff)
downloadjquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.tar.gz
jquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.zip
eol-style and mime-type
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/autocomplete/autocomplete.html70
-rw-r--r--tests/unit/autocomplete/autocomplete_core.js78
-rw-r--r--tests/unit/autocomplete/autocomplete_defaults.js24
-rw-r--r--tests/unit/autocomplete/autocomplete_events.js240
-rw-r--r--tests/unit/autocomplete/autocomplete_methods.js70
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js348
-rw-r--r--tests/unit/autocomplete/autocomplete_tickets.js20
-rw-r--r--tests/unit/button/button.html112
-rw-r--r--tests/unit/button/button_core.js140
-rw-r--r--tests/unit/button/button_defaults.js30
-rw-r--r--tests/unit/button/button_events.js34
-rw-r--r--tests/unit/button/button_methods.js30
-rw-r--r--tests/unit/button/button_options.js138
-rw-r--r--tests/unit/button/button_tickets.js20
14 files changed, 677 insertions, 677 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);
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html
index 8101eb586..4681c062f 100644
--- a/tests/unit/button/button.html
+++ b/tests/unit/button/button.html
@@ -1,56 +1,56 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Button 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.button.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="button_core.js"></script>
- <script type="text/javascript" src="button_defaults.js"></script>
- <script type="text/javascript" src="button_events.js"></script>
- <script type="text/javascript" src="button_methods.js"></script>
- <script type="text/javascript" src="button_options.js"></script>
- <script type="text/javascript" src="button_tickets.js"></script>
-
-</head>
-<body>
-
-<div id="main">
-
- <div><button id="button" class="foo">Label</button></div>
-
- <div id="radio0" style="margin-top: 2em;">
- <input type="radio" id="radio01" name="radio" checked="checked" /><label for="radio01">Choice 1</label>
- <input type="radio" id="radio02" name="radio" /><label for="radio02">Choice 2</label>
- <input type="radio" id="radio03" name="radio" /><label for="radio03">Choice 3</label>
- </div>
- <form>
- <div id="radio1" style="margin-top: 2em;">
- <input type="radio" id="radio11" name="radio" /><label for="radio11">Choice 1</label>
- <input type="radio" id="radio12" name="radio" checked="checked" /><label for="radio12">Choice 2</label>
- <input type="radio" id="radio13" name="radio" /><label for="radio13">Choice 3</label>
- </div>
- </form>
- <form>
- <div id="radio2" style="margin-top: 2em;">
- <input type="radio" id="radio21" name="radio" /><label for="radio21">Choice 1</label>
- <input type="radio" id="radio22" name="radio" /><label for="radio22">Choice 2</label>
- <input type="radio" id="radio23" name="radio" checked="checked" /><label for="radio23">Choice 3</label>
- </div>
- </form>
-
- <input type="checkbox" id="check" /><label for="check">Toggle</label>
-
- <div><input id="submit" type="submit" value="Label" /></div>
-</div>
-
-</body>
-</html>
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Button 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.button.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="button_core.js"></script>
+ <script type="text/javascript" src="button_defaults.js"></script>
+ <script type="text/javascript" src="button_events.js"></script>
+ <script type="text/javascript" src="button_methods.js"></script>
+ <script type="text/javascript" src="button_options.js"></script>
+ <script type="text/javascript" src="button_tickets.js"></script>
+
+</head>
+<body>
+
+<div id="main">
+
+ <div><button id="button" class="foo">Label</button></div>
+
+ <div id="radio0" style="margin-top: 2em;">
+ <input type="radio" id="radio01" name="radio" checked="checked" /><label for="radio01">Choice 1</label>
+ <input type="radio" id="radio02" name="radio" /><label for="radio02">Choice 2</label>
+ <input type="radio" id="radio03" name="radio" /><label for="radio03">Choice 3</label>
+ </div>
+ <form>
+ <div id="radio1" style="margin-top: 2em;">
+ <input type="radio" id="radio11" name="radio" /><label for="radio11">Choice 1</label>
+ <input type="radio" id="radio12" name="radio" checked="checked" /><label for="radio12">Choice 2</label>
+ <input type="radio" id="radio13" name="radio" /><label for="radio13">Choice 3</label>
+ </div>
+ </form>
+ <form>
+ <div id="radio2" style="margin-top: 2em;">
+ <input type="radio" id="radio21" name="radio" /><label for="radio21">Choice 1</label>
+ <input type="radio" id="radio22" name="radio" /><label for="radio22">Choice 2</label>
+ <input type="radio" id="radio23" name="radio" checked="checked" /><label for="radio23">Choice 3</label>
+ </div>
+ </form>
+
+ <input type="checkbox" id="check" /><label for="check">Toggle</label>
+
+ <div><input id="submit" type="submit" value="Label" /></div>
+</div>
+
+</body>
+</html>
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index 1a40d5ee0..255abeaec 100644
--- a/tests/unit/button/button_core.js
+++ b/tests/unit/button/button_core.js
@@ -1,70 +1,70 @@
-/*
- * button_core.js
- */
-
-
-(function($) {
-
-module("button: core");
-
-test("checkbox", function() {
- var input = $("#check");
- label = $("label[for=check]");
- ok( input.is(":visible") );
- ok( label.is(":not(.ui-button)") );
- input.button();
- ok( input.is(":hidden") );
- ok( label.is(".ui-button") );
-});
-
-test("radios", function() {
- var inputs = $("#radio0 input");
- labels = $("#radio0 label");
- ok( inputs.is(":visible") );
- ok( labels.is(":not(.ui-button)") );
- inputs.button();
- ok( inputs.is(":hidden") );
- ok( labels.is(".ui-button") );
-});
-
-function assert(noForm, form1, form2) {
- ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") );
- ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") );
- ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") );
-}
-
-test("radio groups", function() {
- $(":radio").button();
- assert(":eq(0)", ":eq(1)", ":eq(2)");
-
- // click outside of forms
- $("#radio0 .ui-button:eq(1)").click();
- assert(":eq(1)", ":eq(1)", ":eq(2)");
-
- // click in first form
- $("#radio1 .ui-button:eq(0)").click();
- assert(":eq(1)", ":eq(0)", ":eq(2)");
-
- // click in second form
- $("#radio2 .ui-button:eq(0)").click();
- assert(":eq(1)", ":eq(0)", ":eq(0)");
-});
-
-test("input type submit, don't create child elements", function() {
- var input = $("#submit")
- same( input.children().length, 0 );
- input.button();
- same( input.children().length, 0 );
-});
-
-test("buttonset", function() {
- var set = $("#radio1").buttonset();
- ok( set.is(".ui-button-set") );
- same( set.children(".ui-button").length, 3 );
- same( set.children("input:radio:hidden").length, 3 );
- ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") );
- ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") );
- ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
-});
-
-})(jQuery);
+/*
+ * button_core.js
+ */
+
+
+(function($) {
+
+module("button: core");
+
+test("checkbox", function() {
+ var input = $("#check");
+ label = $("label[for=check]");
+ ok( input.is(":visible") );
+ ok( label.is(":not(.ui-button)") );
+ input.button();
+ ok( input.is(":hidden") );
+ ok( label.is(".ui-button") );
+});
+
+test("radios", function() {
+ var inputs = $("#radio0 input");
+ labels = $("#radio0 label");
+ ok( inputs.is(":visible") );
+ ok( labels.is(":not(.ui-button)") );
+ inputs.button();
+ ok( inputs.is(":hidden") );
+ ok( labels.is(".ui-button") );
+});
+
+function assert(noForm, form1, form2) {
+ ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") );
+ ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") );
+ ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") );
+}
+
+test("radio groups", function() {
+ $(":radio").button();
+ assert(":eq(0)", ":eq(1)", ":eq(2)");
+
+ // click outside of forms
+ $("#radio0 .ui-button:eq(1)").click();
+ assert(":eq(1)", ":eq(1)", ":eq(2)");
+
+ // click in first form
+ $("#radio1 .ui-button:eq(0)").click();
+ assert(":eq(1)", ":eq(0)", ":eq(2)");
+
+ // click in second form
+ $("#radio2 .ui-button:eq(0)").click();
+ assert(":eq(1)", ":eq(0)", ":eq(0)");
+});
+
+test("input type submit, don't create child elements", function() {
+ var input = $("#submit")
+ same( input.children().length, 0 );
+ input.button();
+ same( input.children().length, 0 );
+});
+
+test("buttonset", function() {
+ var set = $("#radio1").buttonset();
+ ok( set.is(".ui-button-set") );
+ same( set.children(".ui-button").length, 3 );
+ same( set.children("input:radio:hidden").length, 3 );
+ ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") );
+ ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") );
+ ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
+});
+
+})(jQuery);
diff --git a/tests/unit/button/button_defaults.js b/tests/unit/button/button_defaults.js
index f0152e3c2..e1657854a 100644
--- a/tests/unit/button/button_defaults.js
+++ b/tests/unit/button/button_defaults.js
@@ -1,15 +1,15 @@
-/*
- * button_defaults.js
- */
-
-var button_defaults = {
- disabled: false,
- text: true,
- label: null,
- icons: {
- primary: null,
- secondary: null
- }
-};
-
-commonWidgetTests('button', { defaults: button_defaults });
+/*
+ * button_defaults.js
+ */
+
+var button_defaults = {
+ disabled: false,
+ text: true,
+ label: null,
+ icons: {
+ primary: null,
+ secondary: null
+ }
+};
+
+commonWidgetTests('button', { defaults: button_defaults });
diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js
index 17f505458..4d563ff58 100644
--- a/tests/unit/button/button_events.js
+++ b/tests/unit/button/button_events.js
@@ -1,17 +1,17 @@
-/*
- * button_events.js
- */
-(function($) {
-
-module("button: events");
-
-test("click-through", function() {
- expect(2);
- var set = $("#radio1").buttonset();
- set.find("input:first").click(function() {
- ok( true );
- });
- ok( set.find("label:first").click().is(".ui-button") );
-});
-
-})(jQuery);
+/*
+ * button_events.js
+ */
+(function($) {
+
+module("button: events");
+
+test("click-through", function() {
+ expect(2);
+ var set = $("#radio1").buttonset();
+ set.find("input:first").click(function() {
+ ok( true );
+ });
+ ok( set.find("label:first").click().is(".ui-button") );
+});
+
+})(jQuery);
diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js
index a162a8930..1fcd836b8 100644
--- a/tests/unit/button/button_methods.js
+++ b/tests/unit/button/button_methods.js
@@ -1,15 +1,15 @@
-/*
- * button_methods.js
- */
-(function($) {
-
-
-module("button: methods");
-
-test("destroy", function() {
- var beforeHtml = $("#button").parent().html();
- var afterHtml = $("#button").button().button("destroy").parent().html();
- same( beforeHtml, afterHtml );
-});
-
-})(jQuery);
+/*
+ * button_methods.js
+ */
+(function($) {
+
+
+module("button: methods");
+
+test("destroy", function() {
+ var beforeHtml = $("#button").parent().html();
+ var afterHtml = $("#button").button().button("destroy").parent().html();
+ same( beforeHtml, afterHtml );
+});
+
+})(jQuery);
diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js
index f44679a34..6ee8ab541 100644
--- a/tests/unit/button/button_options.js
+++ b/tests/unit/button/button_options.js
@@ -1,69 +1,69 @@
-/*
- * button_options.js
- */
-(function($) {
-
-module("button: options");
-
-test("text false without icon", function() {
- $("#button").button({
- text: false
- });
- ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") );
-
- $("#button").button("destroy");
-});
-
-test("text false with icon", function() {
- $("#button").button({
- text: false,
- icons: {
- primary: "iconclass"
- }
- });
- ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") );
-
- $("#button").button("destroy");
-});
-
-test("label, default", function() {
- $("#button").button();
- same( $("#button").text(), "Label" );
-
- $("#button").button("destroy");
-});
-
-test("label", function() {
- $("#button").button({
- label: "xxx"
- });
- same( $("#button").text(), "xxx" );
-
- $("#button").button("destroy");
-});
-
-test("label default with input type submit", function() {
- same( $("#submit").button().val(), "Label" );
-});
-
-test("label with input type submit", function() {
- var label = $("#submit").button({
- label: "xxx"
- }).val();
- same( label, "xxx" );
-});
-
-test("icons", function() {
- $("#button").button({
- text: false,
- icons: {
- primary: "iconclass",
- secondary: "iconclass2"
- }
- });
- ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") );
-
- $("#button").button("destroy");
-});
-
-})(jQuery);
+/*
+ * button_options.js
+ */
+(function($) {
+
+module("button: options");
+
+test("text false without icon", function() {
+ $("#button").button({
+ text: false
+ });
+ ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") );
+
+ $("#button").button("destroy");
+});
+
+test("text false with icon", function() {
+ $("#button").button({
+ text: false,
+ icons: {
+ primary: "iconclass"
+ }
+ });
+ ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") );
+
+ $("#button").button("destroy");
+});
+
+test("label, default", function() {
+ $("#button").button();
+ same( $("#button").text(), "Label" );
+
+ $("#button").button("destroy");
+});
+
+test("label", function() {
+ $("#button").button({
+ label: "xxx"
+ });
+ same( $("#button").text(), "xxx" );
+
+ $("#button").button("destroy");
+});
+
+test("label default with input type submit", function() {
+ same( $("#submit").button().val(), "Label" );
+});
+
+test("label with input type submit", function() {
+ var label = $("#submit").button({
+ label: "xxx"
+ }).val();
+ same( label, "xxx" );
+});
+
+test("icons", function() {
+ $("#button").button({
+ text: false,
+ icons: {
+ primary: "iconclass",
+ secondary: "iconclass2"
+ }
+ });
+ ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") );
+
+ $("#button").button("destroy");
+});
+
+})(jQuery);
diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js
index d3b981e21..7f972513d 100644
--- a/tests/unit/button/button_tickets.js
+++ b/tests/unit/button/button_tickets.js
@@ -1,10 +1,10 @@
-/*
- * button_tickets.js
- */
-(function($) {
-
-module("button: tickets");
-
-
-
-})(jQuery);
+/*
+ * button_tickets.js
+ */
+(function($) {
+
+module("button: tickets");
+
+
+
+})(jQuery);