aboutsummaryrefslogtreecommitdiff
path: root/js/tests/ElggLibTest.js
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-04 19:48:31 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-04 19:48:31 +0000
commit048969a77c32190e9590115b67a525d61f4752c6 (patch)
tree97a3e3d8d91db570a82bcb5a4815a6e45ad0170b /js/tests/ElggLibTest.js
parent0ce5ae4b1dcbc4567bb1bd27228eface92ab2bde (diff)
downloadelgg-048969a77c32190e9590115b67a525d61f4752c6.tar.gz
elgg-048969a77c32190e9590115b67a525d61f4752c6.tar.bz2
Refs #2771: Removing CRLFs from javascript files.
git-svn-id: http://code.elgg.org/elgg/trunk@7826 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/tests/ElggLibTest.js')
-rw-r--r--js/tests/ElggLibTest.js166
1 files changed, 83 insertions, 83 deletions
diff --git a/js/tests/ElggLibTest.js b/js/tests/ElggLibTest.js
index 132ad986a..dda1ecd40 100644
--- a/js/tests/ElggLibTest.js
+++ b/js/tests/ElggLibTest.js
@@ -1,84 +1,84 @@
-/**
- * Test basic elgg library functions
- */
-ElggLibTest = TestCase("ElggLibTest");
-
-ElggLibTest.prototype.testGlobal = function() {
- assertTrue(window === elgg.global);
-};
-
-ElggLibTest.prototype.testAssertTypeOf = function() {
- [//Valid inputs
- ['string', ''],
- ['object', {}],
- ['boolean', true],
- ['boolean', false],
- ['undefined', undefined],
- ['number', 0],
- ['function', elgg.nullFunction]
- ].forEach(function(args) {
- assertNoException(function() {
- elgg.assertTypeOf.apply(undefined, args);
- });
- });
-
- [//Invalid inputs
- ['function', {}],
- ['object', elgg.nullFunction]
- ].forEach(function() {
- assertException(function(args) {
- elgg.assertTypeOf.apply(undefined, args);
- });
- });
-};
-
-ElggLibTest.prototype.testProvideDoesntClobber = function() {
- elgg.provide('foo.bar.baz');
-
- foo.bar.baz.oof = "test";
-
- elgg.provide('foo.bar.baz');
-
- assertEquals("test", foo.bar.baz.oof);
-};
-
-/**
- * Try requiring bogus input
- */
-ElggLibTest.prototype.testRequire = function () {
- assertException(function(){ elgg.require(''); });
- assertException(function(){ elgg.require('garbage'); });
- assertException(function(){ elgg.require('gar.ba.ge'); });
-
- assertNoException(function(){
- elgg.require('jQuery');
- elgg.require('elgg');
- elgg.require('elgg.config');
- elgg.require('elgg.security');
- });
-};
-
-ElggLibTest.prototype.testInherit = function () {
- function Base() {}
- function Child() {}
-
- elgg.inherit(Child, Base);
-
- assertInstanceOf(Base, new Child());
- assertEquals(Child, Child.prototype.constructor);
-};
-
-ElggLibTest.prototype.testNormalizeUrl = function() {
- elgg.config.wwwroot = "http://elgg.org/";
-
- [
- ['', elgg.config.wwwroot],
- ['pg/test', elgg.config.wwwroot + 'pg/test'],
- ['http://google.com', 'http://google.com'],
- ['//example.com', '//example.com'],
- ['/pg/page', elgg.config.wwwroot + 'pg/page'],
- ['mod/plugin/index.php', elgg.config.wwwroot + 'mod/plugin/index.php'],
- ].forEach(function(args) {
- assertEquals(args[1], elgg.normalize_url(args[0]));
- });
+/**
+ * Test basic elgg library functions
+ */
+ElggLibTest = TestCase("ElggLibTest");
+
+ElggLibTest.prototype.testGlobal = function() {
+ assertTrue(window === elgg.global);
+};
+
+ElggLibTest.prototype.testAssertTypeOf = function() {
+ [//Valid inputs
+ ['string', ''],
+ ['object', {}],
+ ['boolean', true],
+ ['boolean', false],
+ ['undefined', undefined],
+ ['number', 0],
+ ['function', elgg.nullFunction]
+ ].forEach(function(args) {
+ assertNoException(function() {
+ elgg.assertTypeOf.apply(undefined, args);
+ });
+ });
+
+ [//Invalid inputs
+ ['function', {}],
+ ['object', elgg.nullFunction]
+ ].forEach(function() {
+ assertException(function(args) {
+ elgg.assertTypeOf.apply(undefined, args);
+ });
+ });
+};
+
+ElggLibTest.prototype.testProvideDoesntClobber = function() {
+ elgg.provide('foo.bar.baz');
+
+ foo.bar.baz.oof = "test";
+
+ elgg.provide('foo.bar.baz');
+
+ assertEquals("test", foo.bar.baz.oof);
+};
+
+/**
+ * Try requiring bogus input
+ */
+ElggLibTest.prototype.testRequire = function () {
+ assertException(function(){ elgg.require(''); });
+ assertException(function(){ elgg.require('garbage'); });
+ assertException(function(){ elgg.require('gar.ba.ge'); });
+
+ assertNoException(function(){
+ elgg.require('jQuery');
+ elgg.require('elgg');
+ elgg.require('elgg.config');
+ elgg.require('elgg.security');
+ });
+};
+
+ElggLibTest.prototype.testInherit = function () {
+ function Base() {}
+ function Child() {}
+
+ elgg.inherit(Child, Base);
+
+ assertInstanceOf(Base, new Child());
+ assertEquals(Child, Child.prototype.constructor);
+};
+
+ElggLibTest.prototype.testNormalizeUrl = function() {
+ elgg.config.wwwroot = "http://elgg.org/";
+
+ [
+ ['', elgg.config.wwwroot],
+ ['pg/test', elgg.config.wwwroot + 'pg/test'],
+ ['http://google.com', 'http://google.com'],
+ ['//example.com', '//example.com'],
+ ['/pg/page', elgg.config.wwwroot + 'pg/page'],
+ ['mod/plugin/index.php', elgg.config.wwwroot + 'mod/plugin/index.php'],
+ ].forEach(function(args) {
+ assertEquals(args[1], elgg.normalize_url(args[0]));
+ });
}; \ No newline at end of file