start adding test output to coursewares
This commit is contained in:
@ -62,7 +62,7 @@ function updatePreview() {
|
||||
var previewFrame = document.getElementById('preview');
|
||||
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
|
||||
preview.open();
|
||||
preview.write(libraryIncludes + editor.getValue() + otherTestsForNow);
|
||||
preview.write(libraryIncludes + editor.getValue());
|
||||
preview.close();
|
||||
}
|
||||
setTimeout(updatePreview, 300);
|
||||
@ -81,6 +81,13 @@ eventer(messageEvent,function(e) {
|
||||
}
|
||||
},false);
|
||||
|
||||
var postError = function(data) {
|
||||
console.log(Object.keys(data));
|
||||
var testDoc = document.createElement("div");
|
||||
$(testDoc)
|
||||
.html("<div class='row'><div class='col-xs-1 text-center'><i class='ion-close-circled big-error-icon'></i></div><div class='col-xs-11 test-output wrappable'>" + data + "</div></div><div class='ten-pixel-break'/>")
|
||||
.prependTo($('#testSuite'))
|
||||
};
|
||||
var challengeSeed = challengeSeed || null;
|
||||
var tests = tests || [];
|
||||
var allSeeds = '';
|
||||
|
@ -1,14 +1,19 @@
|
||||
(function() {
|
||||
var allTestsGood = true;
|
||||
var expect = chai.expect;
|
||||
var tests = parent.tests;
|
||||
|
||||
try {
|
||||
eval(parent.allTests);
|
||||
} catch (err) {
|
||||
allTestsGood = false;
|
||||
} finally {
|
||||
if (allTestsGood) {
|
||||
parent.postMessage('CompleteAwesomeSauce', parent.nodeEnv);
|
||||
for (var i = 0; i < tests.length; i++) {
|
||||
|
||||
try {
|
||||
eval(tests[i]);
|
||||
} catch (err) {
|
||||
parent.postError(err);
|
||||
allTestsGood = false;
|
||||
} finally {
|
||||
if (allTestsGood) {
|
||||
parent.postMessage('CompleteAwesomeSauce', parent.nodeEnv);
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
@ -256,7 +256,7 @@
|
||||
" color: blue;",
|
||||
" }",
|
||||
"</style>",
|
||||
"<h1 class=\"red-text\">hello world</h1>",
|
||||
"<h1 class=\"blue-text\">hello world</h1>",
|
||||
"<h2>cat photo app</h2>",
|
||||
"<p>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>"
|
||||
],
|
||||
@ -534,7 +534,7 @@
|
||||
|
||||
{
|
||||
"_id" : "bad87fee1348bd9acdf08812",
|
||||
"name": "Specify an Image Size TEST",
|
||||
"name": "Specify an Image Size",
|
||||
"difficulty" : "0.19",
|
||||
"description": [
|
||||
"Create a class called <code>narrow-image</code> and use it to resize the image so that it's only 200 pixels wide",
|
||||
@ -544,7 +544,7 @@
|
||||
],
|
||||
"tests": [
|
||||
"expect($('img')).to.have.class('narrow-image');",
|
||||
"expect($('img')).to.have.css('width', 200px)"
|
||||
"expect($('img')).to.have.css('width', '200px')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<style>",
|
||||
@ -575,13 +575,13 @@
|
||||
],
|
||||
"tests": [
|
||||
"expect($('img')).to.have.class('thick-green-border');",
|
||||
"expect($('img')).to.have.css('border-color', 'rgb(0,255,0)'));",
|
||||
"expect($('img')).to.have.css('border-color', 'rgb(0,255,0)');",
|
||||
"expect($('img')).to.have.css('border-width', '10px');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<style>",
|
||||
" .narrow-image {",
|
||||
" width: 400px;",
|
||||
" width: 200px;",
|
||||
" }",
|
||||
"",
|
||||
" .thin-red-border {",
|
||||
|
@ -39,6 +39,10 @@ block content
|
||||
button#less-info.btn.btn-info
|
||||
span.ion-help-circled
|
||||
| Less information
|
||||
br
|
||||
ul#testSuite.list-group
|
||||
br
|
||||
script(src='/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js')
|
||||
- if (cc)
|
||||
a.btn.btn-primary.btn-lg.btn-block#next-courseware-button
|
||||
| Go to my next challenge
|
||||
@ -52,13 +56,7 @@ block content
|
||||
script.
|
||||
var userLoggedIn = false;
|
||||
div.hidden
|
||||
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
|
||||
br
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeOutput
|
||||
br
|
||||
#testSuite
|
||||
|
||||
br
|
||||
script(type="text/javascript").
|
||||
$('#next-courseware-button').attr('disabled', 'disabled');
|
||||
|
Reference in New Issue
Block a user