Merge branch 'master' of github.com:FreeCodeCamp/freecodecamp
This commit is contained in:
@ -49,14 +49,9 @@ var libraryIncludes = "<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3
|
||||
"<style>body { padding: 0px 3px 0px 3px; }</style>" +
|
||||
"<script>var expect = chai.expect; var should = chai.should(); var assert = chai.assert;</script>";
|
||||
|
||||
var allTests = '';
|
||||
(function() {
|
||||
tests.forEach(function(elem) {
|
||||
allTests += elem + ' ';
|
||||
});
|
||||
})();
|
||||
|
||||
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts_0.0.2.js'></script>";
|
||||
var editorValueForIFrame;
|
||||
var iFrameScript = "<script src='/js/lib/coursewares/iFrameScripts_0.0.3.js'></script>";
|
||||
|
||||
var delay;
|
||||
// Initialize CodeMirror editor with a nice html5 canvas demo.
|
||||
@ -67,12 +62,13 @@ editor.on("keyup", function () {
|
||||
|
||||
var nodeEnv = prodOrDev === 'production' ? 'http://www.freecodecamp.com' : 'http://localhost:3001';
|
||||
function updatePreview() {
|
||||
editorValueForIFrame = editor.getValue();
|
||||
goodTests = 0;
|
||||
var previewFrame = document.getElementById('preview');
|
||||
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
|
||||
preview.open();
|
||||
$('#testSuite').empty();
|
||||
preview.write(libraryIncludes + editor.getValue() + otherTestsForNow);
|
||||
preview.write(libraryIncludes + editor.getValue() + iFrameScript);
|
||||
preview.close();
|
||||
|
||||
}
|
||||
@ -104,7 +100,6 @@ var testSuccess = function() {
|
||||
}
|
||||
};
|
||||
var challengeSeed = challengeSeed || null;
|
||||
var tests = tests || [];
|
||||
var allSeeds = '';
|
||||
(function() {
|
||||
challengeSeed.forEach(function(elem) {
|
||||
|
@ -1,19 +0,0 @@
|
||||
(function() {
|
||||
var expect = chai.expect;
|
||||
var tests = parent.tests;
|
||||
|
||||
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(/\)/, '')));
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
20
public/js/lib/coursewares/iFrameScripts_0.0.3.js
Normal file
20
public/js/lib/coursewares/iFrameScripts_0.0.3.js
Normal file
@ -0,0 +1,20 @@
|
||||
(function() {
|
||||
var expect = chai.expect;
|
||||
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(/\)/, '')));
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
@ -454,7 +454,7 @@
|
||||
"description": [
|
||||
"Make all paragraph elements use the \"Monospace\" font.",
|
||||
"You can set an element's font by using the <code>font-family</code> attribute.",
|
||||
"For example, if you wanted to set your h2 element's font to \"San-serif\", you would use the following CSS: <code>h2 { font-family: 'San-serif'; }</code>"
|
||||
"For example, if you wanted to set your h2 element's font to \"Sans-serif\", you would use the following CSS: <code>h2 { font-family: 'Sans-serif'; }</code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert($('p').css('font-family').match(/monospace/i), 'Your paragraph elements should use the font \"Monospace\".')"
|
||||
@ -594,6 +594,9 @@
|
||||
"Now see if you can make sure the h2 element is rendered in the color red without removing the \"blue-text\" class, doing an in-line styling, or changing the sequence of CSS class declarations."
|
||||
],
|
||||
"tests": [
|
||||
"assert(new RegExp('.blue-text', 'gi').test(editor), 'Ensure you implemented the css class \".blue-text\"')",
|
||||
"assert(new RegExp('.urgently-red', 'gi').test(editor), 'Ensure you implemented the css class \".urgently-red\"')",
|
||||
"assert(new RegExp('red !important', 'gi').test(editor), 'Ensure you added the \"!important\" declaration!')",
|
||||
"assert($('h2').hasClass('blue-text'), 'Your h2 element should have the class \"blue-text\".')",
|
||||
"assert($('h2').hasClass('urgently-red'), 'Your h2 element should have the class \"urgently-red\".')",
|
||||
"assert($('h2').css('color') === 'rgb(255, 0, 0)', 'Your h2 element should be red.')"
|
||||
@ -734,14 +737,14 @@
|
||||
"name": "Waypoint: Add Borders Around your Elements",
|
||||
"difficulty": 0.028,
|
||||
"description": [
|
||||
"Create a class called \"thick-green-border\" that puts a 10-pixel-wide green border around an HTML element, and apply it to your cat photo.",
|
||||
"Create a class called \"thick-green-border\" that puts a 10-pixel-wide green border with a style of \"solid\" around an HTML element, and apply it to your cat photo.",
|
||||
"CSS borders have attributes like style, color and width.",
|
||||
"For example, if we wanted to create a red, 5 pixel border around an HTML element, we could use this class: <code><style> .thin-red-border { border-color: red; border-width: 5px; border-style: solid; } </style></code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($('img').hasClass('smaller-image'), 'Your <code>img</code> element should have the class \"smaller-image\".')",
|
||||
"assert($('img').hasClass('thick-green-border'), 'Your image element should have the class \"thick-green-border\".')",
|
||||
"assert(parseInt($('img').css('border-left-width')) > 8, 'Your image should have a border with a width of 10 pixels.')"
|
||||
"assert($('img').hasClass('thick-green-border'), 'Your <code>img</code> element should have the class \"thick-green-border\".')",
|
||||
"assert(parseInt($('img').css('border-width')) >= 9 && new RegExp('solid').test($('img').css('border-style')), 'You need to specify a border width of 10px and a border style of \"solid\".')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
|
||||
@ -911,7 +914,7 @@
|
||||
"Here's an example: <code><p>Here's a <a href='http://freecodecamp.com'> link to Free Code Camp</a> for you to follow.</p></code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert((/cat photos/gi).test($('a').text()), 'Your <code>anchor</code> element should have the anchor text of \"See my cat photos\"')",
|
||||
"assert((/cat photos/gi).test($('a').text()), 'Your <code>anchor</code> element should have the anchor text of \"cat photos\"')",
|
||||
"assert($('a').filter(function(index) { return /com/gi.test($('a').attr('href')); }).length > 0, 'You need an <code>anchor</code> element that links to <code>http://catphotoapp.com<code>.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
@ -973,7 +976,7 @@
|
||||
],
|
||||
"tests": [
|
||||
"assert((/photo/gi).test($('a').text()), 'You need an <code>anchor</code> element that links to \"catphotoapp.com\".')",
|
||||
"assert($('a').filter(function(index) { return /photo/gi.test($('a')[index]); }).length === 1, 'Your <code>anchor</code> element should have the anchor text of \"See my cat photos\"')",
|
||||
"assert($('a').filter(function(index) { return /photo/gi.test($('a')[index]); }).length === 1, 'Your <code>anchor</code> element should have the anchor text of \"cat photos\"')",
|
||||
"assert($('a').parent().is('p'), 'Your anchor element should be wrapped within a paragraph element.')"
|
||||
],
|
||||
"challengeSeed": [
|
||||
@ -1099,7 +1102,8 @@
|
||||
"Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link."
|
||||
],
|
||||
"tests": [
|
||||
"expect($('a').children('img').length, 'Wrap your image element inside an anchor element that has its <code>href</code> attribute set to \"#\"').to.equal(1);"
|
||||
"expect($('a').children('img').length, 'Wrap your image element inside an anchor element that has its <code>href</code> attribute set to \"#\"').to.equal(1);",
|
||||
"expect(new RegExp('#').test($('a').children('img').parent().attr('href')), 'Make sure to specify the \"src\" attribute as \"#\"').to.be.true;"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
|
||||
@ -1421,7 +1425,7 @@
|
||||
"name": "Waypoint: Add Placeholder Text to a Text Field",
|
||||
"difficulty": 0.039,
|
||||
"description": [
|
||||
"Add the placeholder text \"type a cat photo URL here\" to your text field.",
|
||||
"Add the placeholder text \"cat photo URL\" to your text field.",
|
||||
"Placeholder text will appear in your text field before your user has inputed anything.",
|
||||
"For example: <code><input type='text' placeholder='this is placeholder text'></code>"
|
||||
],
|
||||
@ -1567,12 +1571,12 @@
|
||||
"name": "Waypoint: Add a Submit Button to a Form",
|
||||
"difficulty": 0.041,
|
||||
"description": [
|
||||
"Add a submit button to your form field.",
|
||||
"Add a submit button to your form field with type <code>submit</code> and a test value of \"Submit\".",
|
||||
"Let's add a submit button to your form. Clicking this button will send the data from your form to the URL you specified with your form's <code>action</code> attribute.",
|
||||
"Here's an example submit button: <code><button type='submit'>this button submits the form</button><code>"
|
||||
],
|
||||
"tests": [
|
||||
"assert($('button').length > 0, 'Your form should have a button inside it.')"
|
||||
"assert(new RegExp('<button type=.submit.>Submit</button>', 'gi').test(editor), 'Make sure you have completely declared your button!');"
|
||||
],
|
||||
"challengeSeed": [
|
||||
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
|
||||
@ -2420,10 +2424,10 @@
|
||||
"You can also use this notation for margins!"
|
||||
],
|
||||
"tests": [
|
||||
"assert($('.green-box').css('margin-left') === '40px', 'Your <code>green-box</code> class should give the left of elements 40px of margin.')",
|
||||
"assert($('.green-box').css('margin-top') === '40px', 'Your <code>green-box</code> class should give the top of elements 40px of margin.')",
|
||||
"assert($('.green-box').css('margin-right') === '20px', 'Your <code>green-box</code> class should give the right of elements 20px of margin.')",
|
||||
"assert($('.green-box').css('margin-bottom') === '20px', 'Your <code>green-box</code> class should give the bottom of elements 20px of margin.')",
|
||||
"assert($('.green-box').css('margin-top') === '40px', 'Your <code>green-box</code> class should give the top of elements 20px of margin.')",
|
||||
"assert($('.green-box').css('margin-right') === '20px', 'Your <code>green-box</code> class should give the right of elements 20px of margin.')"
|
||||
"assert($('.green-box').css('margin-left') === '40px', 'Your <code>green-box</code> class should give the left of elements 40px of margin.')"
|
||||
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
@ -792,7 +792,7 @@
|
||||
"We will make a simple heading for our Cat Photo App by putting them in the same row.",
|
||||
"Remember, Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a <code>div</code> element.",
|
||||
"Here's a diagram of how Bootstrap's 12-column grid layout works:",
|
||||
"<img class='img-responsive' src='https://www.evernote.com/l/AHTwlE2XCLhGFYJzoye_QfsF3ho6y87via4B/image.png'>",
|
||||
"<a href='http://getbootstrap.com/css/#grid' target='_blank'><img class='img-responsive' src='https://www.evernote.com/l/AHTwlE2XCLhGFYJzoye_QfsF3ho6y87via4B/image.png'></a>",
|
||||
"Note that in this illustration, we use the <code>col-md-*</code> class. Here, \"md\" means \"medium\", and \"*\" is a number specifying how many columns wide the element should be. In this case, we're specifying how many columns wide an element should be on a medium-sized screen, such as a laptop.",
|
||||
"In the Cat Photo App that we're building, we'll use <code>col-xs-*</code>, where \"*\" is the number of columns wide the element should be, and \"xs\" means \"extra small\", like an extra-small mobile phone screen.",
|
||||
"Notice how the image is now just the right size to fit along the text?"
|
||||
@ -1044,7 +1044,7 @@
|
||||
},
|
||||
{
|
||||
"_id": "bad87fee1348bd9aedb08845",
|
||||
"name": "Waypoint: Responsively Style a Radio Buttons",
|
||||
"name": "Waypoint: Responsively Style Radio Buttons",
|
||||
"difficulty": 0.059,
|
||||
"description": [
|
||||
"Wrap all of your radio buttons within a <code><div class='row'></code> element. Then wrap each of them within a <code><div class='col-xs-6'></code> element.",
|
||||
@ -1224,7 +1224,7 @@
|
||||
"name": "Waypoint: Style Text Inputs as Form Controls",
|
||||
"difficulty": 0.061,
|
||||
"description": [
|
||||
"Give your form's text input field a class of \"form-control\". Give your form's submit button the classes \"btn btn-primary\" and give it the Font Awesome icon of \"fa-paper-plane\"."
|
||||
"Give your form's text input field a class of <code>form-control</code>. Give your form's submit button the classes <code>btn btn-primary</code> and give it the Font Awesome icon of <code>fa-paper-plane</code>."
|
||||
],
|
||||
"tests": [
|
||||
"assert($('.btn-primary').length > 1, 'Give the submit button in your form the classes \"btn btn-primary\".')",
|
||||
|
@ -285,11 +285,11 @@
|
||||
"Note that you can resize the c9.io's windows by dragging their borders.",
|
||||
"Make sure that you are always in your project's \"workspace\" directory. You can always navigate back to this directory by running this command: <code>cd ~/workspace</code>.",
|
||||
"Complete \"Hello World\"",
|
||||
"Complete \"Juggling Async\"",
|
||||
"Complete \"Time Server\"",
|
||||
"Complete \"HTTP Collect\"",
|
||||
"Complete \"Juggling Async\"",
|
||||
"Complete \"Time Server\"",
|
||||
"Complete \"Jade\"",
|
||||
"Complete \"Good Old Form\"",
|
||||
"Complete \"Stylish CSS\"",
|
||||
"Complete \"Session and Cookie\"",
|
||||
"Complete \"JSON Me\"",
|
||||
"Once you've completed these challenges, move on to our next waypoint."
|
||||
],
|
||||
"challengeType": 2,
|
||||
|
Reference in New Issue
Block a user