aboutsummaryrefslogtreecommitdiff
path: root/engine/js/tests/ElggLibTest.js
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-01 07:34:24 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-01 07:34:24 +0000
commitf3fa93acb1063be2a2de88a6d2841b5d3a982d85 (patch)
tree50ab3704976d7416baa929673395867d3b07f39a /engine/js/tests/ElggLibTest.js
parent7e54b4efb86eecf550c23aa21146d7e191a2da0e (diff)
downloadelgg-f3fa93acb1063be2a2de88a6d2841b5d3a982d85.tar.gz
elgg-f3fa93acb1063be2a2de88a6d2841b5d3a982d85.tar.bz2
Refs #2538: Pulled in elgg JS object and unit tests
git-svn-id: http://code.elgg.org/elgg/trunk@7173 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/js/tests/ElggLibTest.js')
-rw-r--r--engine/js/tests/ElggLibTest.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/engine/js/tests/ElggLibTest.js b/engine/js/tests/ElggLibTest.js
new file mode 100644
index 000000000..1cd1b139c
--- /dev/null
+++ b/engine/js/tests/ElggLibTest.js
@@ -0,0 +1,49 @@
+ElggLibTest = TestCase("ElggLibTest");
+
+ElggLibTest.prototype.testGlobal = function() {
+ assertTrue(window === elgg.global);
+};
+
+ElggLibTest.prototype.testProvide = function() {
+ elgg.provide('foo.bar.baz');
+
+ assertNotUndefined(foo);
+ assertNotUndefined(foo.bar);
+ assertNotUndefined(foo.bar.baz);
+
+ var str = foo.bar.baz.oof = "don't overwrite me";
+
+ elgg.provide('foo.bar.baz');
+
+ assertEquals(str, foo.bar.baz.oof);
+};
+
+ElggLibTest.prototype.testRequire = function() {
+ /* Try requiring bogus input */
+ assertException(function(){ elgg.require(''); });
+ assertException(function(){ elgg.require('garbage'); });
+ assertException(function(){ elgg.require('gar.ba.ge'); });
+
+ assertNoException(function(){ elgg.require('jQuery'); });
+ assertNoException(function(){ elgg.require('elgg'); });
+ assertNoException(function(){ elgg.require('elgg.config'); });
+ assertNoException(function(){ elgg.require('elgg.security'); });
+};
+
+ElggLibTest.prototype.testExtendUrl = function() {
+ var url;
+ elgg.config.wwwroot = "http://www.elgg.org/";
+
+ url = '';
+ assertEquals(elgg.config.wwwroot, elgg.extendUrl(url));
+
+ url = 'pg/test';
+ assertEquals('http://www.elgg.org/pg/test', elgg.extendUrl(url));
+};
+
+
+
+
+
+
+