@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
81 lines (73 loc) • 2.29 kB
HTML
<html>
<head>
<meta charset="ISO-8859-1">
<title>Seanox aspect-js test environment</title>
<style>
body {
font-family: monospace;
}
body div {
margin: 1em;
}
body * {
display: block;
}
</style>
<script src="aspect-js.js"></script>
<script src="scripts/capture.js"></script>
<script type="text/javascript">
Test.activate();
const capture = new Capture();
Composite.listen(Composite.EVENT_RENDER_END, () => {
capture.snap();
const count = capture.patterns().length;
if (capture.size() === count)
Test.start();
if (capture.size() > count)
Assert.assertEquals("expected {1} steps but was {2}", count, capture.size());
});
Test.create({test() {
capture.validate();
}});
// const and Namespace.create(...) in combination
// must work without ReferenceError
const x1 = Namespace.create("x1", {});
Test.create({test() {
Assert.assertEquals("object", typeof x1);
Assert.assertNotNull(x1);
Assert.assertEquals(x1, Namespace.use("x1"));
}});
const nsA1 = Namespace.create("nsA1", {});
Test.create({test() {
Assert.assertEquals("object", typeof nsA1);
Assert.assertNotNull(nsA1);
Assert.assertEquals(nsA1, Namespace.use("nsA1"));
Assert.assertFalse(nsA1 instanceof HTMLElement);
}});
</script>
<script type="text/test">
</script>
</head>
<body>
<div id="moduleD" composite/>
<div id="nsA1" composite namespace>
<div id="nsA2" composite namespace>
<div id="moduleA3" composite namespace>
</div>
</div>
</div>
<div id="nsB1" composite namespace>
<div id="nsB2" composite namespace>
<div id="moduleB3" composite namespace>
<div id="moduleB4" composite>
</div>
</div>
<div id="moduleB5" composite>
<div id="moduleB6" composite>
</div>
</div>
</div>
</div>
</body>
</html>