move spec out of test runner to own file. shows custom runner ability

This commit is contained in:
Geoff Doty 2018-04-02 04:29:54 -04:00
parent d2943f4cb1
commit 9e9fdfab53
2 changed files with 33 additions and 33 deletions

25
test/index.spec.js Normal file
View File

@ -0,0 +1,25 @@
test.it({
"'assert' should exist": function() {
test.exists(test.assert);
},
"truty assert should work": function() {
test.assert(1, '1');
test.assert('1', 1);
},
"'equals' should exist": function() {
test.exists(test.equals);
},
"'equals' should be exact": function() {
test.equals(1,1);
test.equals('hello', 'hello');
},
"'pass' should exist": function() {
test.exists(test.pass);
},
"'fail' should exist": function() {
test.exists(test.fail);
},
"'exists' should exist": function() {
test.exists(test.exists);
}
});

View File

@ -5,43 +5,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Test It Spec</title> <title>Test It Spec</title>
<script src="../src/test.it.js"></script> <script src="../src/test.it.browser.js"></script>
<script src="./index.spec.js"></script>
</head> </head>
<body> <body>
<script> <script>
test.it({ test.run(function(r) {
"'assert' should exist": function() {
test.exists(test.assert);
},
"truty assert should work": function() {
test.assert(1, '1');
test.assert('1', 1);
},
"'equals' should exist": function() {
test.exists(test.equals);
},
"'equals' should be exact": function() {
test.equals(1,1);
test.equals('hello', 'hello');
},
"'pass' should exist": function() {
test.exists(test.pass);
},
"'fail' should exist": function() {
test.exists(test.fail);
},
"'exists' should exist": function() {
test.exists(test.exists);
}
}, function(r) {
if (window.document && document.body) {
document.body.style.backgroundColor = ( document.body.style.backgroundColor = (
r.fail.length ? "#ff9999" : "#99ff99" r.fail.length ? "#ff9999" : "#99ff99"
); );
r.pass.forEach((p) => document.write(`<br>${p}`)); r.pass.forEach((p) => document.write(`<br>${p}`));
r.fail.forEach((f) => document.write(`<br><b>${f}</b>`)); r.fail.forEach((f) => document.write(`<br><b>${f}</b>`));
}
}); });
</script> </script>
</body> </body>