From d63b8f01be15ad38b8dd8409d56a577e756fa90b Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 10 May 2015 21:59:55 -0700 Subject: [PATCH 1/2] improve bonfires and js coursewares --- bower.json | 3 ++- public/css/main.less | 4 ++++ ...ireFramework_v0.1.2.js => bonfireFramework_v0.1.3.js} | 9 +++++---- ...ework_v0.1.1.js => coursewaresHCJQFramework_0.1.1.js} | 2 +- ...resJSFramework.js => coursewaresJSFramework_0.0.1.js} | 8 ++++---- .../{iFrameScripts.js => iFrameScripts_0.0.1.js} | 4 ++-- views/bonfire/show.jade | 4 +--- views/coursewares/showHTML.jade | 2 +- views/coursewares/showJS.jade | 2 +- views/partials/universal-head.jade | 4 +++- 10 files changed, 24 insertions(+), 18 deletions(-) rename public/js/lib/bonfire/{bonfireFramework_v0.1.2.js => bonfireFramework_v0.1.3.js} (95%) rename public/js/lib/coursewares/{coursewaresHCJQFramework_v0.1.1.js => coursewaresHCJQFramework_0.1.1.js} (99%) rename public/js/lib/coursewares/{coursewaresJSFramework.js => coursewaresJSFramework_0.0.1.js} (95%) rename public/js/lib/coursewares/{iFrameScripts.js => iFrameScripts_0.0.1.js} (85%) diff --git a/bower.json b/bower.json index 2f4a0543992..0d92dd37c2e 100644 --- a/bower.json +++ b/bower.json @@ -24,6 +24,7 @@ "bootstrap": "~3.3.4", "font-awesome": "~4.3.0", "moment": "~2.10.2", - "angular-bootstrap": "~0.13.0" + "angular-bootstrap": "~0.13.0", + "ramda": "~0.13.0" } } diff --git a/public/css/main.less b/public/css/main.less index 4b632e2dbca..7d04cbba7c2 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -1073,6 +1073,10 @@ hr { border-radius: 5px; } +.grayed-out-test-output { + color: @gray-light; +} + //uncomment this to see the dimensions of all elements outlined in red //* { // border-color: red; diff --git a/public/js/lib/bonfire/bonfireFramework_v0.1.2.js b/public/js/lib/bonfire/bonfireFramework_v0.1.3.js similarity index 95% rename from public/js/lib/bonfire/bonfireFramework_v0.1.2.js rename to public/js/lib/bonfire/bonfireFramework_v0.1.3.js index 2e68888f53d..0e0c5f50058 100644 --- a/public/js/lib/bonfire/bonfireFramework_v0.1.2.js +++ b/public/js/lib/bonfire/bonfireFramework_v0.1.3.js @@ -197,11 +197,11 @@ var createTestDisplay = function() { var testDoc = document.createElement("div"); if (test.err != null) { $(testDoc) - .html("
" + test.text + "
" + test.err + "
") + .html("
" + test.text + "
" + test.err + "
") .prependTo($('#testSuite')) } else { $(testDoc) - .html("
" + test.text + "
") + .html("
" + test.text + "
") .appendTo($('#testSuite')); } }; @@ -209,6 +209,7 @@ var createTestDisplay = function() { var assert = chai.assert; var expect = chai.expect; var should = chai.should(); +chai.config.showDiff = true; var reassembleTest = function(test, data) { var lineNum = test.line; @@ -233,7 +234,7 @@ var runTests = function(err, data) { } } catch(error) { allTestsPassed = false; - arr[ix].err = error.name + ":" + error.message; + arr[ix].err = error.message; } finally { if (!test) { createTestDisplay(); @@ -258,4 +259,4 @@ function showCompletion() { $('.next-bonfire-button').click(); } }); -} \ No newline at end of file +} diff --git a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.1.js similarity index 99% rename from public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js rename to public/js/lib/coursewares/coursewaresHCJQFramework_0.1.1.js index 6ab42ee738c..4407a23be20 100644 --- a/public/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js +++ b/public/js/lib/coursewares/coursewaresHCJQFramework_0.1.1.js @@ -56,7 +56,7 @@ var allTests = ''; }); })(); -var otherTestsForNow = ""; +var otherTestsForNow = ""; var delay; // Initialize CodeMirror editor with a nice html5 canvas demo. diff --git a/public/js/lib/coursewares/coursewaresJSFramework.js b/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js similarity index 95% rename from public/js/lib/coursewares/coursewaresJSFramework.js rename to public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js index a8cdc78bc2b..c4124e44553 100644 --- a/public/js/lib/coursewares/coursewaresJSFramework.js +++ b/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js @@ -182,11 +182,11 @@ var createTestDisplay = function() { 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')); } }; @@ -218,7 +218,7 @@ var runTests = function(err, data) { } } catch(error) { allTestsPassed = false; - arr[ix].err = error.name + ":" + error.message; + arr[ix].err = error.message; } finally { if (!test) { createTestDisplay(); @@ -243,4 +243,4 @@ function showCompletion() { $('#next-courseware-button').click(); } }); -} \ No newline at end of file +} diff --git a/public/js/lib/coursewares/iFrameScripts.js b/public/js/lib/coursewares/iFrameScripts_0.0.1.js similarity index 85% rename from public/js/lib/coursewares/iFrameScripts.js rename to public/js/lib/coursewares/iFrameScripts_0.0.1.js index 86ac7cff289..efb149c3251 100644 --- a/public/js/lib/coursewares/iFrameScripts.js +++ b/public/js/lib/coursewares/iFrameScripts_0.0.1.js @@ -9,11 +9,11 @@ } catch (err) { allTestsGood = false; thisTest = false; - parent.postError(JSON.stringify(tests[i])); + parent.postError(JSON.stringify(tests[i].message)); } finally { if (thisTest) { parent.postSuccess(JSON.stringify(tests[i])); } } } -})(); \ No newline at end of file +})(); diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index f2284d53a3f..9a28e530c2f 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -15,8 +15,6 @@ block content script(type='text/javascript', src='/js/lib/codemirror/mode/javascript/javascript.js') script(type='text/javascript', src='/js/lib/jailed/jailed.js') script(type='text/javascript', src='/js/lib/bonfire/bonfireInit.js') - script(type='text/javascript', src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min.js") - .row .col-xs-12.col-sm-12.col-md-4.bonfire-top @@ -106,7 +104,7 @@ block content form.code .form-group.codeMirrorView textarea#codeEditor(autofocus=true, style='display: none;') - script(src='/js/lib/bonfire/bonfireFramework_v0.1.2.js') + script(src='/js/lib/bonfire/bonfireFramework_v0.1.3.js') diff --git a/views/coursewares/showHTML.jade b/views/coursewares/showHTML.jade index 840056724d3..6349650804b 100644 --- a/views/coursewares/showHTML.jade +++ b/views/coursewares/showHTML.jade @@ -82,4 +82,4 @@ block content .animated.zoomInDown.delay-half span.completion-icon.ion-checkmark-circled.text-primary a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress - script(src="/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js") + script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.1.js") diff --git a/views/coursewares/showJS.jade b/views/coursewares/showJS.jade index 3e33ee4a4b2..b55d8ad4d97 100644 --- a/views/coursewares/showJS.jade +++ b/views/coursewares/showJS.jade @@ -56,7 +56,7 @@ block content form.code .form-group.codeMirrorView textarea#codeEditor(autofocus=true, style='display: none;') - script(src='/js/lib/coursewares/coursewaresJSFramework.js') + script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.1.js') #complete-courseware-dialog.modal(tabindex='-1') .modal-dialog.animated.zoomIn.fast-animation .modal-content diff --git a/views/partials/universal-head.jade b/views/partials/universal-head.jade index 673c6fe58a4..cfc3fc7b818 100644 --- a/views/partials/universal-head.jade +++ b/views/partials/universal-head.jade @@ -25,7 +25,7 @@ script(src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstra script. if (typeof($.fn.modal) === 'undefined') { document.write('"; +var otherTestsForNow = ""; var delay; // Initialize CodeMirror editor with a nice html5 canvas demo. @@ -92,7 +92,7 @@ var postSuccess = function(data) { var postError = function(data) { var testDoc = document.createElement("div"); $(testDoc) - .html("
" + JSON.parse(data) + "
") + .html("
" + JSON.parse(data) + "
") .prependTo($('#testSuite')) }; var goodTests = 0; diff --git a/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js b/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js index c4124e44553..d32e54428e5 100644 --- a/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js +++ b/public/js/lib/coursewares/coursewaresJSFramework_0.0.1.js @@ -182,7 +182,7 @@ var createTestDisplay = function() { 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) diff --git a/public/js/lib/coursewares/iFrameScripts_0.0.1.js b/public/js/lib/coursewares/iFrameScripts_0.0.1.js index efb149c3251..5856d50b196 100644 --- a/public/js/lib/coursewares/iFrameScripts_0.0.1.js +++ b/public/js/lib/coursewares/iFrameScripts_0.0.1.js @@ -9,10 +9,10 @@ } catch (err) { allTestsGood = false; thisTest = false; - parent.postError(JSON.stringify(tests[i].message)); + parent.postError(JSON.stringify(err.message.split(':').shift())); } finally { if (thisTest) { - parent.postSuccess(JSON.stringify(tests[i])); + parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace(/\'/g, '').replace(/\)/, ''))); } } }