@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
181 lines (152 loc) • 6.67 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
}, (path) => {
if (!path.match(/test/))
return true;
return false;
});
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("#projects#test#description");
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_permit.html#project
T: http://.../mvc_sitemap_permit.html#
#projects
T: http://.../mvc_sitemap_permit.html#projects
#projects#xyz
T: http://.../mvc_sitemap_permit.html#projects#xyz
T: http://.../mvc_sitemap_permit.html#projects
#projects#devwex
T: http://.../mvc_sitemap_permit.html#projects#devwex
#projects#devwexx
T: http://.../mvc_sitemap_permit.html#projects#devwexx
T: http://.../mvc_sitemap_permit.html#projects
#projects#devwex#xyz
T: http://.../mvc_sitemap_permit.html#projects#devwex#xyz
T: http://.../mvc_sitemap_permit.html#projects#devwex
#projects#devwex#description
T: http://.../mvc_sitemap_permit.html#projects#devwex#description
#projects#devwex#description#features
T: http://.../mvc_sitemap_permit.html#projects#devwex#description#features
T: http://.../mvc_sitemap_permit.html#projects#devwex#description
#projects#devwex#description#features#licence
T: http://.../mvc_sitemap_permit.html#projects#devwex#description#features#licence
T: http://.../mvc_sitemap_permit.html#projects#devwex#description
#projects#devwex#features
T: http://.../mvc_sitemap_permit.html#projects#devwex#features
#projects#devwex#licence
T: http://.../mvc_sitemap_permit.html#projects#devwex#licence
#projects#review
T: http://.../mvc_sitemap_permit.html#projects#review
#projects#review#description
T: http://.../mvc_sitemap_permit.html#projects#review#description
#projects#review#features
T: http://.../mvc_sitemap_permit.html#projects#review#features
#projects#review#licence
T: http://.../mvc_sitemap_permit.html#projects#review#licence
#projects#wotexx
T: http://.../mvc_sitemap_permit.html#projects#wotexx
#projects#wotexx#description
T: http://.../mvc_sitemap_permit.html#projects#wotexx#description
#projects#wotexx#features
T: http://.../mvc_sitemap_permit.html#projects#wotexx#features
#projects#wotexx#licence
T: http://.../mvc_sitemap_permit.html#projects#wotexx#licence
#projects#test#description
T: #projects#test##
T: #projects#test#description##
T: http://.../mvc_sitemap_permit.html#projects#test#description
T: http://.../mvc_sitemap_permit.html#projects
#
T: http://.../mvc_sitemap_permit.html#
</script>
</head>
<body>
</body>
</html>