r3407 committed - autocomplete: initial unit testsuite
Revision: 3407
Author: joern.zaefferer
Date: Thu Nov 5 11:25:02 2009
Log: autocomplete: initial unit testsuite
http://code.google.com/p/jquery-ui/source/detail?r=3407
Added:
/branches/dev/tests/unit/autocomplete
/branches/dev/tests/unit/autocomplete/autocomplete.html
/branches/dev/tests/unit/autocomplete/autocomplete_core.js
/branches/dev/tests/unit/autocomplete/autocomplete_defaults.js
/branches/dev/tests/unit/autocomplete/autocomplete_events.js
/branches/dev/tests/unit/autocomplete/autocomplete_methods.js
/branches/dev/tests/unit/autocomplete/autocomplete_options.js
/branches/dev/tests/unit/autocomplete/autocomplete_tickets.js
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete.html Thu Nov 5
11:25:02 2009
@@ -0,0 +1,34 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Autocomplete Test Suite</title>
+
+ <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.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">
+
+ <input />
+
+</div>
+
+</body>
+</html>
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_core.js Thu Nov 5
11:25:02 2009
@@ -0,0 +1,12 @@
+/*
+ * autocomplete_core.js
+ */
+
+
+(function($) {
+
+module("autocomplete: core");
+
+
+
+})(jQuery);
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_defaults.js Thu Nov
5 11:25:02 2009
@@ -0,0 +1,13 @@
+/*
+ * autocomplete_defaults.js
+ */
+
+var autocomplete_defaults = {
+ cache: true,
+ delay: 300,
+ disabled: false,
+ minLength: 1,
+ source: undefined
+};
+
+commonWidgetTests('autocomplete', { defaults: autocomplete_defaults });
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_events.js Thu Nov 5
11:25:02 2009
@@ -0,0 +1,23 @@
+/*
+ * autocomplete_events.js
+ */
+(function($) {
+
+module("autocomplete: events");
+
+test("search", function() {
+});
+
+test("open", function() {
+});
+
+test("focus", function() {
+});
+
+test("close", function() {
+});
+
+test("change", function() {
+});
+
+})(jQuery);
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_methods.js Thu Nov
5 11:25:02 2009
@@ -0,0 +1,13 @@
+/*
+ * autocomplete_methods.js
+ */
+(function($) {
+
+
+module("autocomplete: methods");
+
+test("search", function() {
+
+})
+
+})(jQuery);
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_options.js Thu Nov
5 11:25:02 2009
@@ -0,0 +1,70 @@
+/*
+ * autocomplete_options.js
+ */
+(function($) {
+
+module("autocomplete: options");
+
+// 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"]
+ }
+}
+
+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();
+}
+
+test("cache: true", function() {
+ expect(3);
+ search($("input").autocomplete({
+ source: source
+ }));
+});
+
+test("cache: false", function() {
+ expect(4);
+ search($("input").autocomplete({
+ cache: false,
+ source: source
+ }));
+});
+
+test("delay", function() {
+});
+
+test("minLength", function() {
+});
+
+test("source, url string", function() {
+});
+
+test("source, local string array", function() {
+});
+
+test("source, local object array", function() {
+});
+
+test("source, remote json string array", function() {
+});
+
+test("source, remote json object array", function() {
+});
+
+})(jQuery);
=======================================
--- /dev/null
+++ /branches/dev/tests/unit/autocomplete/autocomplete_tickets.js Thu Nov
5 11:25:02 2009
@@ -0,0 +1,10 @@
+/*
+ * autocomplete_tickets.js
+ */
+(function($) {
+
+module("autocomplete: tickets");
+
+
+
+})(jQuery);