@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
150 lines (140 loc) • 5.1 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();
Namespace.create("model", {
_textA:[""],
set textA(text) {
this._textA[0] = text;
this._textA.push(text);
},
get textA() {
return this._textA.join(" ").trim().replace(/\s+/g, " ");
},
_textB:[""],
set textB(text) {
this._textB[0] = text;
this._textB.push(text);
},
get textB() {
return this._textB.join(" ").trim().replace(/\s+/g, " ");
},
_textC:[""],
set textC(text) {
this._textC[0] = text;
this._textC.push(text);
},
get textC() {
return this._textC.join(" ").trim().replace(/\s+/g, " ");
},
_textD:[""],
set textD(text) {
this._textD[0] = text;
this._textD.push(text);
},
get textD() {
return this._textD.join(" ").trim().replace(/\s+/g, " ");
},
_textE:[""],
set textE(text) {
this._textE[0] = text;
this._textE.push(text);
},
get textE() {
return this._textE.join(" ").trim().replace(/\s+/g, " ");
},
_textF:[""],
set textF(text) {
this._textF[0] = text;
this._textF.push(text);
},
get textF() {
return this._textF.join(" ").trim().replace(/\s+/g, " ");
}
});
let count = 0;
Composite.listen(Composite.EVENT_RENDER_END, () => {
switch (++count) {
case 1:
textA.value = "";
textB.value = "";
textC.value = "";
textD.value = "";
textE.value = "";
textF.value = "";
Composite.asynchron(() => {
textA.typeValue("HelloWorld");
});
return;
case 2:
Composite.asynchron(() => {
textB.typeValue("HelloWorld");
});
return;
case 12:
Composite.asynchron(() => {
textC.typeValue("HelloWorld");
});
return;
case 22:
Composite.asynchron(() => {
textD.typeValue("HelloWorld");
});
return;
case 42:
Composite.asynchron(() => {
textE.typeValue("HelloWorld");
});
Composite.asynchron(() => {
textF.typeValue("HelloWorld");
});
Test.start();
return;
}
});
Test.create({test() {
Assert.assertSameTo("script[type='text/test']", document.body.textContent);
}});
</script>
<script type="text/test">
A:HelloWorld HelloWorld
B:HelloWorl H He Hel Hell Hello HelloW HelloWo HelloWor HelloWorl
C:HelloWorld H He Hel Hell Hello HelloW HelloWo HelloWor HelloWorl HelloWorld
D:HelloWorld H H He He Hel Hel Hell Hell Hello Hello HelloW HelloW HelloWo HelloWo HelloWor HelloWor HelloWorl HelloWorl HelloWorld
E:
F:
</script>
</head>
<body>
<div id="model" composite>
<input id="textA" value="" events="{{'in' + 'put'}}"
render="#textA ~ span">
<span>A:{{model.textA}}</span>
<input id="textB" value="" events="keydown"
render="#textB ~ span">
<span>B:{{model.textB}}</span>
<input id="textC" value="" events="keyup keyup Keyup keyUp"
render="#textC ~ span">
<span>C:{{model.textC}}</span>
<input id="textD" value="" events="keydown keyup"
render="#textD ~ span">
<span>D:{{model.textD}}</span>
<input id="textE" value="" events="change"
render="#textE ~ span">
<span>E:{{model.textE}}</span>
<input id="textF" value="" events="xxx"
render="#textF ~ span">
<span>F:{{model.textF}}</span>
</div>
</body>
</html>