aboutsummaryrefslogtreecommitdiff
path: root/js/tests/ElggLibTest.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/ElggLibTest.js')
-rw-r--r--js/tests/ElggLibTest.js37
1 files changed, 30 insertions, 7 deletions
diff --git a/js/tests/ElggLibTest.js b/js/tests/ElggLibTest.js
index dd0267c5c..c53c6331d 100644
--- a/js/tests/ElggLibTest.js
+++ b/js/tests/ElggLibTest.js
@@ -72,13 +72,36 @@ ElggLibTest.prototype.testNormalizeUrl = function() {
elgg.config.wwwroot = "http://elgg.org/";
[
- ['', elgg.config.wwwroot],
- ['test', elgg.config.wwwroot + 'test'],
- ['http://google.com', 'http://google.com'],
- ['//example.com', '//example.com'],
- ['/page', elgg.config.wwwroot + 'page'],
- ['mod/plugin/index.php', elgg.config.wwwroot + 'mod/plugin/index.php'],
+ ['', 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]));
});
-}; \ No newline at end of file
+};