aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-11-05 15:05:13 -0400
committercash <cash.costello@gmail.com>2011-11-05 15:05:13 -0400
commit604a3bc06281de721e27561341299f1bb9f8ea51 (patch)
tree544ea5b087c637c1ec6bbb9adc48f5dae1fda1bc /js/tests
parent12599e74e44cd9d2ee2c7dbc8b4950fd54aca789 (diff)
downloadelgg-604a3bc06281de721e27561341299f1bb9f8ea51.tar.gz
elgg-604a3bc06281de721e27561341299f1bb9f8ea51.tar.bz2
Fixes #3976 fixed unit tests for normalizing urls and standardized the code from the previous merge
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/ElggLibTest.js55
1 files changed, 28 insertions, 27 deletions
diff --git a/js/tests/ElggLibTest.js b/js/tests/ElggLibTest.js
index 688a1016c..c53c6331d 100644
--- a/js/tests/ElggLibTest.js
+++ b/js/tests/ElggLibTest.js
@@ -72,33 +72,34 @@ ElggLibTest.prototype.testNormalizeUrl = function() {
elgg.config.wwwroot = "http://elgg.org/";
[
- ['', elgg.config.wwwroot],
- ['http://example.com', 'http://example.com'],
- ['https://example.com', 'https://example.com'],
- ['http://example-time.com', 'http://example-time.com'],
- ['//example.com', '//example.com'],
-
- ['ftp://example.com/file', 'ftp://example.com/file',
- ['mailto:brett@elgg.org', 'mailto:brett@elgg.org',
- ['javascript:alert("test")', 'javascript:alert("test")',
- ['app://endpoint', 'app://endpoint',
-
- ['example.com', 'http://example.com',
- ['example.com/subpage', 'http://example.com/subpage',
-
- ['page/handler', elgg.config.wwwroot + 'page/handler',
- ['page/handler?p=v&p2=v2', elgg.config.wwwroot + 'page/handler?p=v&p2=v2',
- ['mod/plugin/file.php', elgg.config.wwwroot + 'mod/plugin/file.php',
- ['mod/plugin/file.php?p=v&p2=v2', elgg.config.wwwroot + 'mod/plugin/file.php?p=v&p2=v2',
- ['rootfile.php', elgg.config.wwwroot + 'rootfile.php',
- ['rootfile.php?p=v&p2=v2', elgg.config.wwwroot + 'rootfile.php?p=v&p2=v2',
-
- ['/page/handler', elgg.config.wwwroot + 'page/handler',
- ['/page/handler?p=v&p2=v2', elgg.config.wwwroot + 'page/handler?p=v&p2=v2',
- ['/mod/plugin/file.php', elgg.config.wwwroot + 'mod/plugin/file.php',
- ['/mod/plugin/file.php?p=v&p2=v2', elgg.config.wwwroot + 'mod/plugin/file.php?p=v&p2=v2',
- ['/rootfile.php', elgg.config.wwwroot + 'rootfile.php',
- ['/rootfile.php?p=v&p2=v2', elgg.config.wwwroot + 'rootfile.php?p=v&p2=v2',
+ ['', elgg.config.wwwroot],
+ ['test', elgg.config.wwwroot + 'test'],
+ ['http://example.com', 'http://example.com'],
+ ['https://example.com', 'https://example.com'],
+ ['http://example-time.com', 'http://example-time.com'],
+ ['//example.com', '//example.com'],
+
+ ['ftp://example.com/file', 'ftp://example.com/file'],
+ ['mailto:brett@elgg.org', 'mailto:brett@elgg.org'],
+ ['javascript:alert("test")', 'javascript:alert("test")'],
+ ['app://endpoint', 'app://endpoint'],
+
+ ['example.com', 'http://example.com'],
+ ['example.com/subpage', 'http://example.com/subpage'],
+
+ ['page/handler', elgg.config.wwwroot + 'page/handler'],
+ ['page/handler?p=v&p2=v2', elgg.config.wwwroot + 'page/handler?p=v&p2=v2'],
+ ['mod/plugin/file.php', elgg.config.wwwroot + 'mod/plugin/file.php'],
+ ['mod/plugin/file.php?p=v&p2=v2', elgg.config.wwwroot + 'mod/plugin/file.php?p=v&p2=v2'],
+ ['rootfile.php', elgg.config.wwwroot + 'rootfile.php'],
+ ['rootfile.php?p=v&p2=v2', elgg.config.wwwroot + 'rootfile.php?p=v&p2=v2'],
+
+ ['/page/handler', elgg.config.wwwroot + 'page/handler'],
+ ['/page/handler?p=v&p2=v2', elgg.config.wwwroot + 'page/handler?p=v&p2=v2'],
+ ['/mod/plugin/file.php', elgg.config.wwwroot + 'mod/plugin/file.php'],
+ ['/mod/plugin/file.php?p=v&p2=v2', elgg.config.wwwroot + 'mod/plugin/file.php?p=v&p2=v2'],
+ ['/rootfile.php', elgg.config.wwwroot + 'rootfile.php'],
+ ['/rootfile.php?p=v&p2=v2', elgg.config.wwwroot + 'rootfile.php?p=v&p2=v2'],
].forEach(function(args) {
assertEquals(args[1], elgg.normalize_url(args[0]));