Bump a delay on test runs and show pattern for expect tests

This commit is contained in:
terakilobyte
2015-06-06 23:58:27 -04:00
parent 00ac753063
commit 7cfca0b5f8
2 changed files with 20 additions and 20 deletions

View File

@ -3,18 +3,21 @@
var tests = parent.tests; var tests = parent.tests;
var editor = parent.editorValueForIFrame; var editor = parent.editorValueForIFrame;
for (var i = 0; i < tests.length; i++) { setTimeout(function() {
var thisTest = true; for (var i = 0; i < tests.length; i++) {
try { var thisTest = true;
eval(parent.tests[i]); try {
} catch (err) { eval(parent.tests[i]);
allTestsGood = false; } catch (err) {
thisTest = false; allTestsGood = false;
parent.postError(JSON.stringify(err.message.split(':').shift())); thisTest = false;
} finally { parent.postError(JSON.stringify(err.message.split(':').shift()));
if (thisTest) { } finally {
parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace(/\'/g, '').replace(/\)/, ''))); if (thisTest) {
parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace(
/\'/g, '').replace(/\)/, '')));
}
} }
} }
} }, 250);
})(); })();

View File

@ -1,8 +1,7 @@
{ {
"name": "jQuery, Ajax and JSON", "name": "jQuery, Ajax and JSON",
"order" : 0.004, "order": 0.004,
"challenges": [ "challenges": [{
{
"_id": "bad87fee1348bd9acdd08826", "_id": "bad87fee1348bd9acdd08826",
"name": "Waypoint: Learn how Script Tags and Document Ready Work", "name": "Waypoint: Learn how Script Tags and Document Ready Work",
"difficulty": 0.072, "difficulty": 0.072,
@ -54,7 +53,7 @@
"Make all <code>img</code> elements bounce $('img').addClass('animated bounce')" "Make all <code>img</code> elements bounce $('img').addClass('animated bounce')"
], ],
"tests": [ "tests": [
"expect($('img'), 'Make sure you add the animated bounce class').to.have.class('animated bounce')"
], ],
"challengeSeed": [ "challengeSeed": [
"fccss", "fccss",
@ -483,8 +482,7 @@
], ],
"challengeType": 0 "challengeType": 0
}, }, {
{
"_id": "bad87fee1348bd9aede08826", "_id": "bad87fee1348bd9aede08826",
"name": "Waypoint: Use Hex Codes for Precise Colors", "name": "Waypoint: Use Hex Codes for Precise Colors",
"difficulty": 0.071, "difficulty": 0.071,
@ -498,8 +496,7 @@
], ],
"challengeType": 0 "challengeType": 0
}, }, {
{
"_id": "bad87fee1348bd9aedd08826", "_id": "bad87fee1348bd9aedd08826",
"name": "Waypoint: Use Shortened Hex Codes for Colors", "name": "Waypoint: Use Shortened Hex Codes for Colors",
"difficulty": 0.071, "difficulty": 0.071,