diff --git a/public/js/lib/coursewares/coursewaresJSFramework.js b/public/js/lib/coursewares/coursewaresJSFramework.js index 72a24eff4d..60af334324 100644 --- a/public/js/lib/coursewares/coursewaresJSFramework.js +++ b/public/js/lib/coursewares/coursewaresJSFramework.js @@ -34,21 +34,6 @@ if (attempts) { attempts = 0; } -// Default value for editor if one isn't provided in (i.e. a challenge) -var nonChallengeValue = '/*Welcome to Bonfire, Free Code Camp\'s future CoderByte replacement.\n' + - 'Please feel free to use Bonfire as an in-browser playground and linting tool.\n' + - 'Note that you can also write tests using Chai.js by using the keywords assert and expect */\n\n' + - 'function test() {\n' + - ' assert(2 !== 3, "2 is not equal to 3");\n' + - ' return [1,2,3].map(function(elem) {\n' + - ' return elem * elem;\n' + - ' });\n' + - '}\n' + - 'expect(test()).to.be.a("array");\n\n' + - 'assert.deepEqual(test(), [1,4,9]);\n\n' + - 'var foo = test();\n' + - 'foo.should.be.a("array");\n\n' + - 'test();\n'; var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), { lineNumbers: false, @@ -183,12 +168,13 @@ var createTestDisplay = function() { var test = userTests[i]; var testDoc = document.createElement("div"); if (test.err != null) { + console.log('Should be displaying bad tests'); $(testDoc) - .html("
" + test.text + "
" + test.err + "
") + .html("
" + test.text + "
" + test.err + "
") .prependTo($('#testSuite')) } else { $(testDoc) - .html("
" + test.text + "
") + .html("
" + test.text + "
") .appendTo($('#testSuite')); } }; @@ -220,8 +206,11 @@ var runTests = function(err, data) { } } catch(error) { allTestsPassed = false; - console.log(error); arr[ix].err = error.name + ":" + error.message; + } finally { + if (!test) { + createTestDisplay(); + } } }); diff --git a/views/coursewares/showJS.jade b/views/coursewares/showJS.jade index 71c8e037e3..3570432d41 100644 --- a/views/coursewares/showJS.jade +++ b/views/coursewares/showJS.jade @@ -42,7 +42,7 @@ block content .form-group.codeMirrorView textarea#codeOutput br - #testSuite.hidden + #testSuite br script(type="text/javascript"). var tests = !{JSON.stringify(tests)};