summaryrefslogtreecommitdiff
path: root/js_tests/admin/RelatedObjectLookups.test.js
diff options
context:
space:
mode:
authorTrey Hunner <trey@treyhunner.com>2015-04-14 10:55:57 -0400
committerTim Graham <timograham@gmail.com>2015-06-30 21:04:16 -0400
commit2d0dead224b6448072b72b37d2fbcc8dc3afa007 (patch)
tree6dfb01a60cefc0dcf5cdcb35ac5c946a2cab98e0 /js_tests/admin/RelatedObjectLookups.test.js
parent3bbaf84d6533fb61ac0038f2bbe52ee0d7b4fd10 (diff)
DEP 0003 -- Added JavaScript unit tests.
Setup QUnit, added tests, and measured test coverage. Thanks to Nick Sanford for the initial tests.
Diffstat (limited to 'js_tests/admin/RelatedObjectLookups.test.js')
-rw-r--r--js_tests/admin/RelatedObjectLookups.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js_tests/admin/RelatedObjectLookups.test.js b/js_tests/admin/RelatedObjectLookups.test.js
new file mode 100644
index 0000000000..b2e2e1841b
--- /dev/null
+++ b/js_tests/admin/RelatedObjectLookups.test.js
@@ -0,0 +1,22 @@
+module('admin.RelatedObjectLookups');
+
+test('html_unescape', function(assert) {
+ function assert_unescape(then, expected, message) {
+ assert.equal(html_unescape(then), expected, message);
+ }
+ assert_unescape('&lt;', '<', 'less thans are unescaped');
+ assert_unescape('&gt;', '>', 'greater thans are unescaped');
+ assert_unescape('&quot;', '"', 'double quotes are unescaped');
+ assert_unescape('&#39;', "'", 'single quotes are unescaped');
+ assert_unescape('&amp;', '&', 'ampersands are unescaped');
+});
+
+test('id_to_windowname', function(assert) {
+ assert.equal(id_to_windowname('.test'), '__dot__test');
+ assert.equal(id_to_windowname('misc-test'), 'misc__dash__test');
+});
+
+test('windowname_to_id', function(assert) {
+ assert.equal(windowname_to_id('__dot__test'), '.test');
+ assert.equal(windowname_to_id('misc__dash__test'), 'misc-test');
+});