From 7cfca0b5f8831b72c5c7e62c2570b3619d1a2f46 Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Sat, 6 Jun 2015 23:58:27 -0400 Subject: [PATCH] Bump a delay on test runs and show pattern for expect tests --- .../js/lib/coursewares/iFrameScripts_0.0.4.js | 27 ++++++++++--------- .../challenges/future-jquery-ajax-json.json | 13 ++++----- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/public/js/lib/coursewares/iFrameScripts_0.0.4.js b/public/js/lib/coursewares/iFrameScripts_0.0.4.js index 7691582f4a8..2092acc0663 100644 --- a/public/js/lib/coursewares/iFrameScripts_0.0.4.js +++ b/public/js/lib/coursewares/iFrameScripts_0.0.4.js @@ -3,18 +3,21 @@ var tests = parent.tests; var editor = parent.editorValueForIFrame; - for (var i = 0; i < tests.length; i++) { - var thisTest = true; - try { - eval(parent.tests[i]); - } catch (err) { - allTestsGood = false; - thisTest = false; - parent.postError(JSON.stringify(err.message.split(':').shift())); - } finally { - if (thisTest) { - parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace(/\'/g, '').replace(/\)/, ''))); + setTimeout(function() { + for (var i = 0; i < tests.length; i++) { + var thisTest = true; + try { + eval(parent.tests[i]); + } catch (err) { + allTestsGood = false; + thisTest = false; + parent.postError(JSON.stringify(err.message.split(':').shift())); + } finally { + if (thisTest) { + parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace( + /\'/g, '').replace(/\)/, ''))); + } } } - } + }, 250); })(); diff --git a/seed_data/challenges/future-jquery-ajax-json.json b/seed_data/challenges/future-jquery-ajax-json.json index d82aba29154..acab88f2c63 100644 --- a/seed_data/challenges/future-jquery-ajax-json.json +++ b/seed_data/challenges/future-jquery-ajax-json.json @@ -1,8 +1,7 @@ { "name": "jQuery, Ajax and JSON", - "order" : 0.004, - "challenges": [ - { + "order": 0.004, + "challenges": [{ "_id": "bad87fee1348bd9acdd08826", "name": "Waypoint: Learn how Script Tags and Document Ready Work", "difficulty": 0.072, @@ -54,7 +53,7 @@ "Make all img elements bounce $('img').addClass('animated bounce')" ], "tests": [ - + "expect($('img'), 'Make sure you add the animated bounce class').to.have.class('animated bounce')" ], "challengeSeed": [ "fccss", @@ -483,8 +482,7 @@ ], "challengeType": 0 - }, - { + }, { "_id": "bad87fee1348bd9aede08826", "name": "Waypoint: Use Hex Codes for Precise Colors", "difficulty": 0.071, @@ -498,8 +496,7 @@ ], "challengeType": 0 - }, - { + }, { "_id": "bad87fee1348bd9aedd08826", "name": "Waypoint: Use Shortened Hex Codes for Colors", "difficulty": 0.071,