@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
53 lines (50 loc) • 1.5 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();
const snapshots = [];
Composite.listen(Composite.EVENT_RENDER_END, () => {
const snapshot = document.body.textContent.trim();
snapshots.push(snapshot);
if (snapshots.length === 4)
Test.start();
if (snapshots.length > 4)
Assert.assertEquals("expected {1} steps but was {2}", 4, snapshots.length);
});
Test.create({test() {
Assert.assertSameTo("script[type='text/test", snapshots[3]);
}});
const modelA = {
valueA: ["Spring", "Winter"]
}.reactive();
window.setTimeout(() => {modelA.valueA = ["Spring", "Summer", "Autumn", "Winter"];}, 1000);
</script>
<script type="text/test">
_A_Spring,Summer,Autumn,Winter_
_B_Spring,Summer,Autumn,Winter_
Spring
Summer
Autumn
Winter
</script>
</head>
<body>
_A_{{modelA.valueA}}_
_B_{{modelA.valueA}}_
<select iterate={{months:modelA.valueA}}>
<option value="{{months.index}}">
{{months.item}}
</option>
</select>
</body>
</html>