@seanox/aspect-js
Version:
full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, virtual paths, unit test and some more
126 lines (111 loc) • 6.02 kB
HTML
<html>
<head>
<meta charset="ISO-8859-1">
<title>Seanox aspect-js test environment</title>
<style>
body {
font-family: monospace;
white-space: pre;
}
</style>
<script src="aspect-js.js"></script>
<script type="text/javascript">
Test.activate();
Test.create({test() {
Assert.assertNull(Path.normalize());
Assert.assertNull(Path.normalize(null));
Assert.assertEquals("#", Path.normalize(""));
Assert.assertEquals("#", Path.normalize("#"));
Assert.assertEquals("#", Path.normalize("##"));
Assert.assertEquals("###", Path.normalize("###"));
Assert.assertEquals("###", Path.normalize("####"));
Assert.assertEquals("###", Path.normalize("#####"));
Assert.assertEquals("#1#2#3", Path.normalize("#1#2#3"));
Assert.assertEquals("#1#2#3", Path.normalize("#1#2#3", "#"));
Assert.assertEquals("#x#y#z", Path.normalize("#x#y#z#", ""));
Assert.assertEquals("#x#y", Path.normalize("#x#y#z##", ""));
Assert.assertEquals("#x", Path.normalize("#x#y#z###", ""));
Assert.assertEquals("#x#y#z", Path.normalize("#x#y#z#", "#"));
Assert.assertEquals("#x#y", Path.normalize("#x#y#z##", "#"));
Assert.assertEquals("#x", Path.normalize("#x#y#z###", "#"));
}});
Test.create({test() {
Assert.assertEquals("#aaa", Path.normalize("aaa"));
Assert.assertEquals("#aaa#bbb", Path.normalize("aaa#bbb"));
Assert.assertEquals("#aaa#bbb#ccc", Path.normalize("aaa#bbb#ccc"));
Assert.assertEquals("#aaa#bbb#ccc", Path.normalize("aaa#bbb#ccc#"));
Assert.assertEquals("#aaa#bbb", Path.normalize("aaa#bbb#ccc##"));
Assert.assertEquals("#aaa", Path.normalize("aaa#bbb#ccc###"));
Assert.assertEquals("#", Path.normalize("aaa#bbb#ccc####"));
Assert.assertEquals("#", Path.normalize("aaa#bbb#ccc#####"));
}});
Test.create({test() {
Assert.assertEquals("#aaa", Path.normalize("#aaa"));
Assert.assertEquals("#aaa#bbb", Path.normalize("#aaa#bbb"));
Assert.assertEquals("#aaa#bbb#ccc", Path.normalize("#aaa#bbb#ccc"));
Assert.assertEquals("#aaa#bbb#ccc", Path.normalize("#aaa#bbb#ccc#"));
Assert.assertEquals("#aaa#bbb", Path.normalize("#aaa#bbb#ccc##"));
Assert.assertEquals("#aaa", Path.normalize("#aaa#bbb#ccc###"));
Assert.assertEquals("#", Path.normalize("#aaa#bbb#ccc####"));
Assert.assertEquals("#", Path.normalize("#aaa#bbb#ccc#####"));
}});
Test.create({test() {
Assert.assertEquals("#a#b#c#d#f", Path.normalize("#a#b#c#d#e##f"));
Assert.assertEquals("#a#b#c#f", Path.normalize("#a#b#c#d#e###f"));
Assert.assertEquals("#f", Path.normalize("###f"));
Assert.assertEquals("#f", Path.normalize("####f"));
}});
Test.create({test() {
Assert.assertEquals("#x#y#z#a#b#c#d#f", Path.normalize("#x#y#z", "#a#b#c#d#e##f"));
Assert.assertEquals("#x#y#z#a#b#c#f", Path.normalize("#x#y#z", "#a#b#c#d#e###f"));
Assert.assertEquals("#x#f", Path.normalize("#x#y#z", "###f"));
Assert.assertEquals("#f", Path.normalize("#x#y#z", "####f"));
Assert.assertEquals("#f", Path.normalize("#x#y#z", "#####f"));
Assert.assertEquals("#f", Path.normalize("#x#y#z", "######f"));
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local\/#a#b#c#d#e##f/i, test() {
Path.normalize("httpx://local/#x#y#z", "httpx://local/#a#b#c#d#e##f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local\/#a#b#c#d#e###f/i, test() {
Path.normalize("httpx://local/#x#y#z", "httpx://local/#a#b#c#d#e###f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local\/###f/i, test() {
Path.normalize("httpx://local/#x#y#z", "httpx://local/###f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local####f/i, test() {
Path.normalize("httpx://local#x#y#z", "httpx://local####f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local####f/i, test() {
Path.normalize("httpx://local#x#y#z", "httpx://local####f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local#####f/i, test() {
Path.normalize("httpx://local#x#y#z", "httpx://local#####f");
}});
Test.create({expected:/\bInvalid path: httpx:\/\/local######f/i, test() {
Path.normalize("httpx://local#x#y#z", "httpx://local######f");
}});
Test.create({expected:/\bInvalid path: object/i, test() {
Path.normalize({});
}});
Test.create({expected:/\bInvalid path: boolean/i, test() {
Path.normalize(true);
}});
Test.create({expected:/\bInvalid root: object/i, test() {
Path.normalize({}, "#");
}});
Test.create({expected:/\bInvalid root: boolean/i, test() {
Path.normalize(true, "#");
}});
Test.create({test() {
Assert.assertEquals("#a#b#c#d", Path.normalize("#a#b#c#d"));
Assert.assertEquals("#a#b#c#x", Path.normalize("#a#b#c#d##x"));
Assert.assertEquals("#a#b#x", Path.normalize("#a#b#c#d###x"));
Assert.assertEquals("#a#x", Path.normalize("#a#b#c#d####x"));
}});
Test.start({auto:true});
</script>
</head>
<body>
</body>
</html>