UNPKG

@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
<!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: #a O: null I: #a#b O: null I: #home O: {"path":"#home","face":"#","facet":"home"} I: #home#a O: null I: #home#a#b O: null I: #contact O: {"path":"#contact","face":"#","facet":"contact","data":null} I: #contact#a O: {"path":"#contact#a","face":"#","facet":"contact","data":"#a"} I: #contact#a#b O: {"path":"#contact#a#b","face":"#","facet":"contact","data":"#a#b"} I: #project O: {"path":"#project","face":"#project","facet":null,"data":null} I: #project#a O: {"path":"#project#a","face":"#project","facet":null,"data":"#a"} I: #project#a#b O: {"path":"#project#a#b","face":"#project","facet":null,"data":"#a#b"} I: #team O: {"path":"#team","face":"#team","facet":null,"data":null} I: #team#a O: {"path":"#team#a","face":"#team","facet":null,"data":"#a"} I: #team#a#b O: {"path":"#team#a#b","face":"#team","facet":null,"data":"#a#b"} I: #team#x O: {"path":"#team#x","face":"#team","facet":null,"data":"#x"} I: #team#x#a O: {"path":"#team#x#a","face":"#team","facet":null,"data":"#x#a"} I: #team#x#a#b 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>