mirror of https://github.com/n2geoff/testit.git
move spec out of test runner to own file. shows custom runner ability
This commit is contained in:
parent
d2943f4cb1
commit
9e9fdfab53
|
@ -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);
|
||||||
|
}
|
||||||
|
});
|
|
@ -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() {
|
document.body.style.backgroundColor = (
|
||||||
test.exists(test.assert);
|
r.fail.length ? "#ff9999" : "#99ff99"
|
||||||
},
|
);
|
||||||
"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 = (
|
|
||||||
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>
|
||||||
|
|
Loading…
Reference in New Issue