@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
209 lines (180 loc) • 7.62 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();
SiteMap.customize({
"#": ["news", "projects", "seanox", "contact", "contact#about"],
"#projects#aspect": ["description", "features", "licence", "requirement", "download"],
"#projects#aspect-js": ["description", "features", "licence", "requirement", "download"],
"#projects#devwex": ["description", "features", "licence", "requirement", "download"],
"#projects#review": ["description", "features", "licence", "requirement", "download"],
"#projects#roundup": ["description", "features", "licence", "requirement", "download"],
"#projects#test": ["description", "features", "licence", "requirement", "download"],
"#projects#wotexx": ["description", "features", "licence", "requirement", "download"],
"#legal": ["terms", "privacy"],
"#error": null
});
SiteMap.customize(/es|ea/, (path) => {
logging("1: " + path);
return true;
});
SiteMap.customize(/w#d/, (path) => {
logging("2: " + path);
return false;
});
SiteMap.customize(/w#l/, (path) => {
logging("3: " + path);
return "#legal#terms#aaa#bbb#ccc";
});
SiteMap.customize(/#d/, (path) => {
logging("4: " + path);
return true;
});
const logging = (message) => {
document.body.innerHTML += "\r\n" + message;
document.body.innerHTML = document.body.innerHTML.trim();
};
const targets = [];
window.addEventListener("load", () => {
targets.push("#");
targets.push("#project");
targets.push("#projects");
targets.push("#projects#xyz");
targets.push("#projects#devwex");
targets.push("#projects#devwexx");
targets.push("#projects#devwex#xyz");
targets.push("#projects#devwex#description");
targets.push("#projects#devwex#description#features");
targets.push("#projects#devwex#description#features#licence");
targets.push("#projects#devwex#features");
targets.push("#projects#devwex#licence");
targets.push("#projects#review");
targets.push("#projects#review#description");
targets.push("#projects#review#features");
targets.push("#projects#review#licence");
targets.push("#projects#wotexx");
targets.push("#projects#wotexx#description");
targets.push("#projects#wotexx#features");
targets.push("#projects#wotexx#licence");
targets.push("#");
Composite.asynchron(() => {
document.body.innerHTML = "";
const target = targets.shift();
logging("\r\n" + target);
window.location.href = target;
});
});
let timeout;
window.addEventListener("hashchange", (event) => {
if (timeout)
window.clearTimeout(timeout);
logging("T: " + event.newURL);
timeout = window.setTimeout(() => {
if (targets.length > 0) {
const target = targets.shift();
logging("\r\n" + target);
window.location.href = target;
} else Test.start();
}, 50);
});
Test.create({test() {
let content = document.body.innerHTML;
content = content.replace(/(\w+:\/{2,}).*\//mg, "$1.../");
content = content.replace(/(\shttp)s(:\/\/)/g, "$1$2");
document.body.textContent = content;
Assert.assertSameTo("script[type='text/test']", content);
}});
let errors = "";
Composite.listen(Composite.EVENT_ERROR, (event, error) => {
errors += "\r\n" + error.message;
errors = errors.trim();
});
Test.create({test() {
Assert.assertEquals("", errors);
}});
</script>
<script type="text/test">
#
#project
T: http://.../mvc_sitemap_acceptors.html#project
T: http://.../mvc_sitemap_acceptors.html#
#projects
T: http://.../mvc_sitemap_acceptors.html#projects
#projects#xyz
T: http://.../mvc_sitemap_acceptors.html#projects#xyz
T: http://.../mvc_sitemap_acceptors.html#projects
#projects#devwex
4: #projects#devwex
T: http://.../mvc_sitemap_acceptors.html#projects#devwex
#projects#devwexx
T: http://.../mvc_sitemap_acceptors.html#projects#devwexx
T: http://.../mvc_sitemap_acceptors.html#projects
#projects#devwex#xyz
4: #projects#devwex
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#xyz
T: http://.../mvc_sitemap_acceptors.html#projects#devwex
#projects#devwex#description
1: #projects#devwex#description
4: #projects#devwex#description
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#description
#projects#devwex#description#features
1: #projects#devwex#description
4: #projects#devwex#description
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#description#features
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#description
#projects#devwex#description#features#licence
1: #projects#devwex#description
4: #projects#devwex#description
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#description#features#licence
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#description
#projects#devwex#features
1: #projects#devwex#features
4: #projects#devwex#features
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#features
#projects#devwex#licence
4: #projects#devwex#licence
T: http://.../mvc_sitemap_acceptors.html#projects#devwex#licence
#projects#review
T: http://.../mvc_sitemap_acceptors.html#projects#review
#projects#review#description
1: #projects#review#description
2: #projects#review#description
T: #projects#review#description##
T: http://.../mvc_sitemap_acceptors.html#projects#review#description
T: http://.../mvc_sitemap_acceptors.html#projects#review
#projects#review#features
1: #projects#review#features
T: http://.../mvc_sitemap_acceptors.html#projects#review#features
#projects#review#licence
3: #projects#review#licence
T: #legal#terms#aaa#bbb#ccc
T: http://.../mvc_sitemap_acceptors.html#projects#review#licence
T: http://.../mvc_sitemap_acceptors.html#legal#terms
#projects#wotexx
T: http://.../mvc_sitemap_acceptors.html#projects#wotexx
#projects#wotexx#description
1: #projects#wotexx#description
4: #projects#wotexx#description
T: http://.../mvc_sitemap_acceptors.html#projects#wotexx#description
#projects#wotexx#features
1: #projects#wotexx#features
T: http://.../mvc_sitemap_acceptors.html#projects#wotexx#features
#projects#wotexx#licence
T: http://.../mvc_sitemap_acceptors.html#projects#wotexx#licence
#
T: http://.../mvc_sitemap_acceptors.html#
</script>
</head>
<body>
</body>
</html>