summaryrefslogtreecommitdiffstats
path: root/install/ui/test
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-05-16 22:23:20 -0500
committerAdam Young <ayoung@redhat.com>2011-05-20 12:11:47 -0400
commit46137fdf898690836ae61e54b1cb2711492287f3 (patch)
treeb64b936fca3f738bdd19862113d8005b72e4eb82 /install/ui/test
parent00abd47de4d3238295cbe5dc30210b913c0f07a1 (diff)
downloadfreeipa-46137fdf898690836ae61e54b1cb2711492287f3.tar.gz
freeipa-46137fdf898690836ae61e54b1cb2711492287f3.tar.xz
freeipa-46137fdf898690836ae61e54b1cb2711492287f3.zip
jQuery ordered map.
The ordered map is a jQuery extension for creating a collection which can be accessed both as an ordered list and as a map. This collection can be used to store various objects including entities, fields, columns, and dialogs. A test suite for this class has been added as well. Ticket #1232
Diffstat (limited to 'install/ui/test')
-rwxr-xr-xinstall/ui/test/aci_tests.html1
-rw-r--r--install/ui/test/all_tests.html2
-rw-r--r--install/ui/test/association_tests.html1
-rwxr-xr-xinstall/ui/test/certificate_tests.html1
-rw-r--r--install/ui/test/details_tests.html1
-rw-r--r--install/ui/test/details_tests.js4
-rw-r--r--install/ui/test/entity_tests.html1
-rw-r--r--install/ui/test/index.html1
-rw-r--r--install/ui/test/ipa_tests.html1
-rw-r--r--install/ui/test/navigation_tests.html1
-rwxr-xr-xinstall/ui/test/ordered_map_tests.html21
-rwxr-xr-xinstall/ui/test/ordered_map_tests.js128
-rwxr-xr-xinstall/ui/test/widget_tests.html1
13 files changed, 162 insertions, 2 deletions
diff --git a/install/ui/test/aci_tests.html b/install/ui/test/aci_tests.html
index 0847e1501..be035c413 100755
--- a/install/ui/test/aci_tests.html
+++ b/install/ui/test/aci_tests.html
@@ -10,6 +10,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../widget.js"></script>
<script type="text/javascript" src="../dialog.js"></script>
diff --git a/install/ui/test/all_tests.html b/install/ui/test/all_tests.html
index 1d2c7b300..be0bf3ea1 100644
--- a/install/ui/test/all_tests.html
+++ b/install/ui/test/all_tests.html
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../widget.js"></script>
<script type="text/javascript" src="../dialog.js"></script>
@@ -18,6 +19,7 @@
<script type="text/javascript" src="../navigation.js"></script>
<script type="text/javascript" src="../certificate.js"></script>
<script type="text/javascript" src="../aci.js"></script>
+ <script type="text/javascript" src="ordered_map_tests.js"></script>
<script type="text/javascript" src="ipa_tests.js"></script>
<script type="text/javascript" src="details_tests.js"></script>
<script type="text/javascript" src="entity_tests.js"></script>
diff --git a/install/ui/test/association_tests.html b/install/ui/test/association_tests.html
index 383c9b0b6..e9e3650ba 100644
--- a/install/ui/test/association_tests.html
+++ b/install/ui/test/association_tests.html
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../details.js"></script>
<script type="text/javascript" src="../search.js"></script>
diff --git a/install/ui/test/certificate_tests.html b/install/ui/test/certificate_tests.html
index 5b411ff13..dd8ccb6e3 100755
--- a/install/ui/test/certificate_tests.html
+++ b/install/ui/test/certificate_tests.html
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../details.js"></script>
<script type="text/javascript" src="../search.js"></script>
diff --git a/install/ui/test/details_tests.html b/install/ui/test/details_tests.html
index ee3679b9c..e83e70e24 100644
--- a/install/ui/test/details_tests.html
+++ b/install/ui/test/details_tests.html
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../widget.js"></script>
<script type="text/javascript" src="../dialog.js"></script>
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 2715b4eac..8f98f1fef 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -62,7 +62,7 @@ test("Testing IPA.details_section.create().", function() {
section.entity_name = 'user';
section.init();
- var fields = section.fields;
+ var fields = section.fields.values;
var container = $("<div/>");
section.create(container);
@@ -264,7 +264,7 @@ test("Testing IPA.details_section_setup again()",function(){
text({name:'cn', label:'Entity Name'}).
text({name:'description', label:'Description'}).
text({name:'number', label:'Entity ID'});
- var fields = section.fields;
+ var fields = section.fields.values;
var container = $("<div title='entity'/>");
var details = $("<div/>");
container.append(details);
diff --git a/install/ui/test/entity_tests.html b/install/ui/test/entity_tests.html
index e512d4380..8b41f8fe9 100644
--- a/install/ui/test/entity_tests.html
+++ b/install/ui/test/entity_tests.html
@@ -6,6 +6,7 @@
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../widget.js"></script>
<script type="text/javascript" src="../dialog.js"></script>
diff --git a/install/ui/test/index.html b/install/ui/test/index.html
index 948cce000..3552cc77e 100644
--- a/install/ui/test/index.html
+++ b/install/ui/test/index.html
@@ -24,6 +24,7 @@
<div id="content">
<a href="all_tests.html">Complete Test Suite</a>
<ul>
+ <li><a href="ordered_map_tests.html">Ordered Map Test Suite</a>
<li><a href="ipa_tests.html">Core Test Suite</a>
<li><a href="entity_tests.html">Entity Test Suite</a>
<li><a href="details_tests.html">Details Test Suite</a>
diff --git a/install/ui/test/ipa_tests.html b/install/ui/test/ipa_tests.html
index 903e71545..8f8ab93ef 100644
--- a/install/ui/test/ipa_tests.html
+++ b/install/ui/test/ipa_tests.html
@@ -9,6 +9,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="ipa_tests.js"></script>
</head>
diff --git a/install/ui/test/navigation_tests.html b/install/ui/test/navigation_tests.html
index 16d095aca..a1a68f7f6 100644
--- a/install/ui/test/navigation_tests.html
+++ b/install/ui/test/navigation_tests.html
@@ -7,6 +7,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../entity.js"></script>
<script type="text/javascript" src="../navigation.js"></script>
diff --git a/install/ui/test/ordered_map_tests.html b/install/ui/test/ordered_map_tests.html
new file mode 100755
index 000000000..dda669348
--- /dev/null
+++ b/install/ui/test/ordered_map_tests.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Ordered Map Test Suite</title>
+ <link rel="stylesheet" href="qunit.css" type="text/css" media="screen">
+ <link rel="stylesheet" type="text/css" href="../jquery-ui.css" />
+
+ <script type="text/javascript" src="qunit.js"></script>
+ <script type="text/javascript" src="../jquery.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
+ <script type="text/javascript" src="ordered_map_tests.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Ordered Map Test Suite</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"></div>
+</body>
+</html>
diff --git a/install/ui/test/ordered_map_tests.js b/install/ui/test/ordered_map_tests.js
new file mode 100755
index 000000000..b708a1283
--- /dev/null
+++ b/install/ui/test/ordered_map_tests.js
@@ -0,0 +1,128 @@
+/* Authors:
+ * Endi Sukma Dewata <edewata@redhat.com>
+ *
+ * Copyright (C) 2010 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+module('ordered_map');
+
+test("Testing $.ordered_map constructor.", function() {
+
+ var test = $.ordered_map();
+
+ strictEqual(test.length, 0, "Checking length.");
+ deepEqual(test.keys, [], "Checking keys.");
+ deepEqual(test.values, [], "Checking values.");
+ deepEqual(test.map, {}, "Checking map.");
+});
+
+test("Testing $.ordered_map.put().", function() {
+
+ var test = $.ordered_map();
+
+ var key1 = 'key1';
+ var value1 = 'value1';
+
+ var key2 = 'key2';
+ var value2 = 'value2';
+
+ var map = {};
+ map[key1] = value1;
+ map[key2] = value2;
+
+ test.put(key1, value1);
+ test.put(key2, value2);
+
+ strictEqual(test.length, 2, 'Checking length.');
+ deepEqual(test.keys, [key1, key2], 'Checking keys.');
+ deepEqual(test.values, [value1, value2], 'Checking values.');
+ deepEqual(test.map, map, 'Checking map.');
+});
+
+test("Testing $.ordered_map.get().", function() {
+
+ var test = $.ordered_map();
+
+ var key1 = 'key1';
+ var value1 = 'value1';
+
+ var key2 = 'key2';
+ var value2 = 'value2';
+
+ var map = {};
+ map[key1] = value1;
+ map[key2] = value2;
+
+ test.put(key1, value1);
+ test.put(key2, value2);
+
+ var result1 = test.get(key1);
+ var result2 = test.get(key2);
+
+ strictEqual(test.length, 2, 'Checking length.');
+ deepEqual(test.keys, [key1, key2], 'Checking keys.');
+ deepEqual(test.values, [value1, value2], 'Checking values.');
+ deepEqual(test.map, map, 'Checking map.');
+ strictEqual(result1, value1, 'Checking result 1.');
+ strictEqual(result2, value2, 'Checking result 2.');
+});
+
+test("Testing $.ordered_map.remove().", function() {
+
+ var test = $.ordered_map();
+
+ var key1 = 'key1';
+ var value1 = 'value1';
+
+ var key2 = 'key2';
+ var value2 = 'value2';
+
+ var map = {};
+ map[key2] = value2;
+
+ test.put(key1, value1);
+ test.put(key2, value2);
+
+ var result1 = test.remove(key1);
+
+ strictEqual(test.length, 1, 'Checking length.');
+ deepEqual(test.keys, [key2], 'Checking keys.');
+ deepEqual(test.values, [value2], 'Checking values.');
+ deepEqual(test.map, map, 'Checking map.');
+ strictEqual(result1, value1, 'Checking result.');
+});
+
+test("Testing $.ordered_map.empty().", function() {
+
+ var test = $.ordered_map();
+
+ var key1 = 'key1';
+ var value1 = 'value1';
+
+ var key2 = 'key2';
+ var value2 = 'value2';
+
+ test.put(key1, value1);
+ test.put(key2, value2);
+
+ test.empty();
+
+ strictEqual(test.length, 0, 'Checking length.');
+ deepEqual(test.keys, [], 'Checking keys.');
+ deepEqual(test.values, [], 'Checking values.');
+ deepEqual(test.map, {}, 'Checking map.');
+});
diff --git a/install/ui/test/widget_tests.html b/install/ui/test/widget_tests.html
index e38b44216..e504f6133 100755
--- a/install/ui/test/widget_tests.html
+++ b/install/ui/test/widget_tests.html
@@ -10,6 +10,7 @@
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../jquery.ba-bbq.js"></script>
<script type="text/javascript" src="../jquery-ui.js"></script>
+ <script type="text/javascript" src="../jquery.ordered-map.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../widget.js"></script>