UNPKG

@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

63 lines (58 loc) 1.97 kB
<!DOCTYPE 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 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 === 1) Test.start(); if (snapshots.length >= 1) Assert.assertEquals("expected {1} steps but was {2}", 1, snapshots.length); }); Test.create({test() { Assert.assertEquals("undefined", typeof moduleA); Assert.assertEquals("undefined", typeof moduleB); Assert.assertEquals("undefined", typeof moduleC); }}); Test.create({test() { Assert.assertEquals("object", typeof moduleD); Assert.assertTrue(moduleD instanceof Element); Assert.assertEquals("object", typeof moduleE); Assert.assertEquals("E", moduleE.test); Assert.assertEquals("object", typeof moduleF); Assert.assertEquals("F", moduleF.test); Assert.assertEquals("object", typeof moduleG); Assert.assertEquals("G", moduleG.test); Assert.assertEquals("object", typeof moduleH); Assert.assertUndefined(moduleH.test); }}); Test.create({test() { Assert.assertFalse(document.body.innerText.includes("moduleE is not defined")); }}); </script> </head> <body> --- <div id="moduleD" composite/> --- <div id="moduleK" composite/> --- </body> </html>