@seanox/aspect-js
Version:
full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, routing, paths, unit test and some more
98 lines (94 loc) • 2.45 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());
});
// Named access on the Window object
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#named-access-on-the-window-object
// No model has been implemented for ns6.
// But here "named access on the Window object" takes effect and the
// browser creates an object with the same name.
Test.create({test() {
capture.validate();
}});
</script>
<script type="text/test">
---- ns3
undefined
undefined
object
false
---- ns4
undefined
undefined
undefined
object
---- ns5
object
false
---- ns6
object
true
----
</script>
</head>
<body>
---- ns3
<div id="ns3@nsA" composite></div>
<div id="ns3@nsA:a" composite></div>
<div id="ns3@nsA:a:b" composite></div>
<pre>
{{(?typeof ns3)}}
{{(?typeof nsA.ns3)}}
{{(?typeof nsA.a.ns3)}}
{{(?typeof nsA.a.b.ns3)}}
</pre>
---- ns4
<div id="ns4@nsB" composite></div>
<div id="ns4@nsB:a" composite></div>
<div id="ns4@nsB:a:b" composite></div>
<pre>
{{(?typeof ns4)}}
{{(?typeof nsB.ns4)}}
{{(?typeof nsB.a.ns4)}}
{{(?typeof nsB.a.b.ns4)}}
</pre>
---- ns5
<div id="ns5" composite></div>
<pre>
{{typeof ns5}}
{{ns5 instanceof Element}}
</pre>
---- ns6
<div id="ns6" composite></div>
<pre>
{{typeof ns6}}
{{ns6 instanceof Element}}
</pre>
----
</body>
</html>