@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
108 lines (103 loc) • 3.22 kB
HTML
<!DOCTYPE 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({
"#": ["home", "projects", "about", "contact..."],
"#project": ["..."],
"#project#a": ["..."],
"#team": ["...", "a", "b", "c"],
"#team#a": ["..."],
"#team#x": ["..."]
});
const tests = [
"#",
"#a",
"#a#b",
"#home",
"#home#a",
"#home#a#b",
"#contact",
"#contact#a",
"#contact#a#b",
"#project",
"#project#a",
"#project#a#b",
"#team",
"#team#a",
"#team#a#b",
"#team#x",
"#team#x#a",
"#team#x#a#b",
"#"
];
Test.create({test() {
document.body.innerHTML = "";
tests.forEach((test) => {
document.body.innerHTML = document.body.innerHTML.trim();
if (document.body.innerHTML)
document.body.innerHTML += "\r\n";
let lookup = SiteMap.lookup(test);
if (typeof lookup === "object")
lookup = lookup === null ? "null" : lookup.toPlainString();
document.body.innerHTML += "I: " + test
+ "\r\nO: " + lookup;
});
Assert.assertSameTo("script[type='text/test']", document.body.textContent);
}});
Test.start({auto:true});
</script>
<script type="text/test">
I:
O: {"path":"#","face":"#","facet":null}
I:
O: null
I:
O: null
I:
O: {"path":"#home","face":"#","facet":"home"}
I:
O: null
I:
O: null
I:
O: {"path":"#contact","face":"#","facet":"contact","data":null}
I:
O: {"path":"#contact#a","face":"#","facet":"contact","data":"#a"}
I:
O: {"path":"#contact#a#b","face":"#","facet":"contact","data":"#a#b"}
I:
O: {"path":"#project","face":"#project","facet":null,"data":null}
I:
O: {"path":"#project#a","face":"#project","facet":null,"data":"#a"}
I:
O: {"path":"#project#a#b","face":"#project","facet":null,"data":"#a#b"}
I:
O: {"path":"#team","face":"#team","facet":null,"data":null}
I:
O: {"path":"#team#a","face":"#team","facet":null,"data":"#a"}
I:
O: {"path":"#team#a#b","face":"#team","facet":null,"data":"#a#b"}
I:
O: {"path":"#team#x","face":"#team","facet":null,"data":"#x"}
I:
O: {"path":"#team#x#a","face":"#team","facet":null,"data":"#x#a"}
I:
O: {"path":"#team#x#a#b","face":"#team","facet":null,"data":"#x#a#b"}
I:
O: {"path":"#","face":"#","facet":null}
</script>
</head>
<body>
</body>
</html>