From 322bf80b9b59c1b13782bd5a27abad28ac8d4eb6 Mon Sep 17 00:00:00 2001 From: Doug Ouverson Date: Mon, 3 Sep 2018 21:08:43 -0400 Subject: [PATCH] fix(challenges): small edit to correct sematic issues should have said elements and not tags --- .../basic-html-and-html5.json | 557 ++++++++++++------ 1 file changed, 371 insertions(+), 186 deletions(-) diff --git a/challenges/01-responsive-web-design/basic-html-and-html5.json b/challenges/01-responsive-web-design/basic-html-and-html5.json index c445da4e41b08a..6ce44e76b4726d 100644 --- a/challenges/01-responsive-web-design/basic-html-and-html5.json +++ b/challenges/01-responsive-web-design/basic-html-and-html5.json @@ -23,8 +23,10 @@ ], "tests": [ { - "text": "Your h1 element should have the text \"Hello World\".", - "testString": "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\".');" + "text": + "Your h1 element should have the text \"Hello World\".", + "testString": + "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\".');" } ], "challengeType": 0, @@ -123,19 +125,25 @@ "tests": [ { "text": "Create an h2 element.", - "testString": "assert(($(\"h2\").length > 0), 'Create an h2 element.');" + "testString": + "assert(($(\"h2\").length > 0), 'Create an h2 element.');" }, { "text": "Make sure your h2 element has a closing tag.", - "testString": "assert(code.match(/<\\/h2>/g) && code.match(/<\\/h2>/g).length === code.match(/

/g).length, 'Make sure your h2 element has a closing tag.');" + "testString": + "assert(code.match(/<\\/h2>/g) && code.match(/<\\/h2>/g).length === code.match(/

/g).length, 'Make sure your h2 element has a closing tag.');" }, { - "text": "Your h2 element should have the text \"CatPhotoApp\".", - "testString": "assert.isTrue((/cat(\\s)?photo(\\s)?app/gi).test($(\"h2\").text()), 'Your h2 element should have the text \"CatPhotoApp\".');" + "text": + "Your h2 element should have the text \"CatPhotoApp\".", + "testString": + "assert.isTrue((/cat(\\s)?photo(\\s)?app/gi).test($(\"h2\").text()), 'Your h2 element should have the text \"CatPhotoApp\".');" }, { - "text": "Your h1 element should have the text \"Hello World\".", - "testString": "assert.isTrue((/hello(\\s)+world/gi).test($(\"h1\").text()), 'Your h1 element should have the text \"Hello World\".');" + "text": + "Your h1 element should have the text \"Hello World\".", + "testString": + "assert.isTrue((/hello(\\s)+world/gi).test($(\"h1\").text()), 'Your h1 element should have the text \"Hello World\".');" } ], "challengeType": 0, @@ -208,15 +216,19 @@ "tests": [ { "text": "Create a p element.", - "testString": "assert(($(\"p\").length > 0), 'Create a p element.');" + "testString": + "assert(($(\"p\").length > 0), 'Create a p element.');" }, { - "text": "Your p element should have the text \"Hello Paragraph\".", - "testString": "assert.isTrue((/hello(\\s)+paragraph/gi).test($(\"p\").text()), 'Your p element should have the text \"Hello Paragraph\".');" + "text": + "Your p element should have the text \"Hello Paragraph\".", + "testString": + "assert.isTrue((/hello(\\s)+paragraph/gi).test($(\"p\").text()), 'Your p element should have the text \"Hello Paragraph\".');" }, { "text": "Make sure your p element has a closing tag.", - "testString": "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/

p element has a closing tag.');" + "testString": + "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/

p element has a closing tag.');" } ], "challengeType": 0, @@ -284,8 +296,10 @@ ], "tests": [ { - "text": "Your p element should contain the first few words of the provided kitty ipsum text.", - "testString": "assert.isTrue((/Kitty(\\s)+ipsum/gi).test($(\"p\").text()), 'Your p element should contain the first few words of the provided kitty ipsum text.');" + "text": + "Your p element should contain the first few words of the provided kitty ipsum text.", + "testString": + "assert.isTrue((/Kitty(\\s)+ipsum/gi).test($(\"p\").text()), 'Your p element should contain the first few words of the provided kitty ipsum text.');" } ], "challengeType": 0, @@ -359,20 +373,28 @@ ], "tests": [ { - "text": "Make your h1 element visible on your page by uncommenting it.", - "testString": "assert($(\"h1\").length > 0, 'Make your h1 element visible on your page by uncommenting it.');" + "text": + "Make your h1 element visible on your page by uncommenting it.", + "testString": + "assert($(\"h1\").length > 0, 'Make your h1 element visible on your page by uncommenting it.');" }, { - "text": "Make your h2 element visible on your page by uncommenting it.", - "testString": "assert($(\"h2\").length > 0, 'Make your h2 element visible on your page by uncommenting it.');" + "text": + "Make your h2 element visible on your page by uncommenting it.", + "testString": + "assert($(\"h2\").length > 0, 'Make your h2 element visible on your page by uncommenting it.');" }, { - "text": "Make your p element visible on your page by uncommenting it.", - "testString": "assert($(\"p\").length > 0, 'Make your p element visible on your page by uncommenting it.');" + "text": + "Make your p element visible on your page by uncommenting it.", + "testString": + "assert($(\"p\").length > 0, 'Make your p element visible on your page by uncommenting it.');" }, { - "text": "Be sure to delete all trailing comment tags, i.e. -->.", - "testString": "assert(!/[^fc]-->/gi.test(code.replace(/ */gi.test(code.replace(/ */g).length > 1, 'Be sure to close each of your comments with -->.');" + "text": + "Be sure to close each of your comments with -->.", + "testString": + "assert(code.match(/[^fc]-->/g).length > 1, 'Be sure to close each of your comments with -->.');" }, { - "text": "Do not change the order of the h1 h2 or p in the code.", - "testString": "assert((code.match(/<([a-z0-9]){1,2}>/g)[0]===\"

\" && code.match(/<([a-z0-9]){1,2}>/g)[1]===\"

\" && code.match(/<([a-z0-9]){1,2}>/g)[2]===\"

\") , 'Do not change the order of the h1 h2 or p in the code.');" + "text": + "Do not change the order of the h1 h2 or p in the code.", + "testString": + "assert((code.match(/<([a-z0-9]){1,2}>/g)[0]===\"

\" && code.match(/<([a-z0-9]){1,2}>/g)[1]===\"

\" && code.match(/<([a-z0-9]){1,2}>/g)[2]===\"

\") , 'Do not change the order of the h1 h2 or p in the code.');" } ], "challengeType": 0, @@ -536,15 +568,18 @@ "tests": [ { "text": "Delete your h1 element.", - "testString": "assert(!code.match(/

/gi) && !code.match(/<\\/h1>/gi), 'Delete your h1 element.');" + "testString": + "assert(!code.match(/

/gi) && !code.match(/<\\/h1>/gi), 'Delete your h1 element.');" }, { "text": "Leave your h2 element on the page.", - "testString": "assert(code.match(/

[\\w\\W]*<\\/h2>/gi), 'Leave your h2 element on the page.');" + "testString": + "assert(code.match(/

[\\w\\W]*<\\/h2>/gi), 'Leave your h2 element on the page.');" }, { "text": "Leave your p element on the page.", - "testString": "assert(code.match(/

[\\w\\W]*<\\/p>/gi), 'Leave your p element on the page.');" + "testString": + "assert(code.match(/

[\\w\\W]*<\\/p>/gi), 'Leave your p element on the page.');" } ], "solutions": [ @@ -620,31 +655,43 @@ "tests": [ { "text": "You need 2 p elements with Kitty Ipsum text.", - "testString": "assert($(\"p\").length > 1, 'You need 2 p elements with Kitty Ipsum text.');" + "testString": + "assert($(\"p\").length > 1, 'You need 2 p elements with Kitty Ipsum text.');" }, { - "text": "Make sure each of your p elements has a closing tag.", - "testString": "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/

p elements has a closing tag.');" + "text": + "Make sure each of your p elements has a closing tag.", + "testString": + "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/

p elements has a closing tag.');" }, { - "text": "Your p element should contain the first few words of the provided additional kitty ipsum text.", - "testString": "assert.isTrue((/Purr\\s+jump\\s+eat/gi).test($(\"p\").text()), 'Your p element should contain the first few words of the provided additional kitty ipsum text.');" + "text": + "Your p element should contain the first few words of the provided additional kitty ipsum text.", + "testString": + "assert.isTrue((/Purr\\s+jump\\s+eat/gi).test($(\"p\").text()), 'Your p element should contain the first few words of the provided additional kitty ipsum text.');" }, { "text": "Your code should have one main element.", - "testString": "assert($('main').length === 1, 'Your code should have one main element.');" + "testString": + "assert($('main').length === 1, 'Your code should have one main element.');" }, { - "text": "The main element should have two paragraph elements as children.", - "testString": "assert($(\"main\").children(\"p\").length === 2, 'The main element should have two paragraph elements as children.');" + "text": + "The main element should have two paragraph elements as children.", + "testString": + "assert($(\"main\").children(\"p\").length === 2, 'The main element should have two paragraph elements as children.');" }, { - "text": "The opening main tag should come before the first paragraph tag.", - "testString": "assert(code.match(/

\\s*?

/g), 'The opening main tag should come before the first paragraph tag.');" + "text": + "The opening main tag should come before the first paragraph tag.", + "testString": + "assert(code.match(/

\\s*?

/g), 'The opening main tag should come before the first paragraph tag.');" }, { - "text": "The closing main tag should come after the second closing paragraph tag.", - "testString": "assert(code.match(/<\\/p>\\s*?<\\/main>/g), 'The closing main tag should come after the second closing paragraph tag.');" + "text": + "The closing main tag should come after the second closing paragraph tag.", + "testString": + "assert(code.match(/<\\/p>\\s*?<\\/main>/g), 'The closing main tag should come after the second closing paragraph tag.');" } ], "challengeType": 0, @@ -700,15 +747,20 @@ "tests": [ { "text": "Your page should have an image element.", - "testString": "assert($(\"img\").length > 0, 'Your page should have an image element.');" + "testString": + "assert($(\"img\").length > 0, 'Your page should have an image element.');" }, { - "text": "Your image should have a src attribute that points to the kitten image.", - "testString": "assert(new RegExp(\"\\/\\/bit.ly\\/fcc-relaxing-cat|\\/\\/s3.amazonaws.com\\/freecodecamp\\/relaxing-cat.jpg\", \"gi\").test($(\"img\").attr(\"src\")), 'Your image should have a src attribute that points to the kitten image.');" + "text": + "Your image should have a src attribute that points to the kitten image.", + "testString": + "assert(new RegExp(\"\\/\\/bit.ly\\/fcc-relaxing-cat|\\/\\/s3.amazonaws.com\\/freecodecamp\\/relaxing-cat.jpg\", \"gi\").test($(\"img\").attr(\"src\")), 'Your image should have a src attribute that points to the kitten image.');" }, { - "text": "Your image element must have an alt attribute.", - "testString": "assert(code.match(/alt\\s*?=\\s*?(\\\"|\\').*(\\\"|\\')/), 'Your image element must have an alt attribute.');" + "text": + "Your image element must have an alt attribute.", + "testString": + "assert(code.match(/alt\\s*?=\\s*?(\\\"|\\').*(\\\"|\\')/), 'Your image element must have an alt attribute.');" } ], "challengeType": 0, @@ -768,7 +820,8 @@ ] } }, - "guideUrl": "https://guide.freecodecamp.org/certificates/add-images-to-your-website", + "guideUrl": + "https://guide.freecodecamp.org/certificates/add-images-to-your-website", "files": { "indexhtml": { "key": "indexhtml", @@ -801,16 +854,21 @@ ], "tests": [ { - "text": "Your a element should have the anchor text of \"cat photos\".", - "testString": "assert((/cat photos/gi).test($(\"a\").text()), 'Your a element should have the anchor text of \"cat photos\".');" + "text": + "Your a element should have the anchor text of \"cat photos\".", + "testString": + "assert((/cat photos/gi).test($(\"a\").text()), 'Your a element should have the anchor text of \"cat photos\".');" }, { - "text": "You need an a element that links to http://freecatphotoapp.com", - "testString": "assert(/http:\\/\\/(www\\.)?freecatphotoapp\\.com/gi.test($(\"a\").attr(\"href\")), 'You need an a element that links to http://freecatphotoapp.com');" + "text": + "You need an a element that links to http://freecatphotoapp.com", + "testString": + "assert(/http:\\/\\/(www\\.)?freecatphotoapp\\.com/gi.test($(\"a\").attr(\"href\")), 'You need an a element that links to http://freecatphotoapp.com');" }, { "text": "Make sure your a element has a closing tag.", - "testString": "assert(code.match(/<\\/a>/g) && code.match(/<\\/a>/g).length === code.match(/a element has a closing tag.');" + "testString": + "assert(code.match(/<\\/a>/g) && code.match(/<\\/a>/g).length === code.match(/a element has a closing tag.');" } ], "challengeType": 0, @@ -903,33 +961,44 @@ "tests": [ { "text": "There should be only one anchor tag on your page.", - "testString": "assert($('a').length == 1, 'There should be only one anchor tag on your page.');" + "testString": + "assert($('a').length == 1, 'There should be only one anchor tag on your page.');" }, { - "text": "There should be only one footer tag on your page.", - "testString": "assert($('footer').length == 1, 'There should be only one footer tag on your page.');" + "text": + "There should be only one footer tag on your page.", + "testString": + "assert($('footer').length == 1, 'There should be only one footer tag on your page.');" }, { - "text": "The a tag should have an href attribute set to \"#footer\".", - "testString": "assert($('a').eq(0).attr('href') == \"#footer\", 'The a tag should have an href attribute set to \"#footer\".');" + "text": + "The a tag should have an href attribute set to \"#footer\".", + "testString": + "assert($('a').eq(0).attr('href') == \"#footer\", 'The a tag should have an href attribute set to \"#footer\".');" }, { - "text": "The a tag should not have a target attribute", - "testString": "assert(typeof $('a').eq(0).attr('target') == typeof undefined || $('a').eq(0).attr('target') == true, 'The a tag should not have a target attribute');" + "text": + "The a tag should not have a target attribute", + "testString": + "assert(typeof $('a').eq(0).attr('target') == typeof undefined || $('a').eq(0).attr('target') == true, 'The a tag should not have a target attribute');" }, { "text": "The a text should be \"Jump to Bottom\".", - "testString": "assert($('a').eq(0).text().match(/Jump to Bottom/gi), 'The a text should be \"Jump to Bottom\".');" + "testString": + "assert($('a').eq(0).text().match(/Jump to Bottom/gi), 'The a text should be \"Jump to Bottom\".');" }, { - "text": "The footer tag should have an id attribute set to \"footer\".", - "testString": "assert($('footer').eq(0).attr('id') == \"footer\", 'The footer tag should have an id attribute set to \"footer\".');" + "text": + "The footer tag should have an id attribute set to \"footer\".", + "testString": + "assert($('footer').eq(0).attr('id') == \"footer\", 'The footer tag should have an id attribute set to \"footer\".');" } ], "challengeType": 0, "translations": { "pt-br": { - "title": "Crie links para seções internas de uma página com elementos âncora", + "title": + "Crie links para seções internas de uma página com elementos âncora", "description": [ "Além de criar links externos, elementos âncora também podem ser usados para criar links internos, que são links que pulam para diferentes seções dentro de uma mesma página.", "O formato é parecido com um link externo, só que, ao invés de uma URL no atributo href, você usa o símbolo # e uma palavra para descrever a seção para a qual você quer pular.", @@ -990,36 +1059,52 @@ ], "tests": [ { - "text": "You need an a element that links to \"http://freecatphotoapp.com\".", - "testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").length > 0 || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").length > 0), 'You need an a element that links to \"http://freecatphotoapp.com\".');" + "text": + "You need an a element that links to \"http://freecatphotoapp.com\".", + "testString": + "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").length > 0 || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").length > 0), 'You need an a element that links to \"http://freecatphotoapp.com\".');" }, { - "text": "Your a element should have the anchor text of \"cat photos\"", - "testString": "assert($(\"a\").text().match(/cat\\sphotos/gi), 'Your a element should have the anchor text of \"cat photos\"');" + "text": + "Your a element should have the anchor text of \"cat photos\"", + "testString": + "assert($(\"a\").text().match(/cat\\sphotos/gi), 'Your a element should have the anchor text of \"cat photos\"');" }, { - "text": "Create a new p element around your a element. There should be at least 3 total p tags in your HTML code.", - "testString": "assert($(\"p\") && $(\"p\").length > 2, 'Create a new p element around your a element. There should be at least 3 total p tags in your HTML code.');" + "text": + "Create a new p element around your a element. There should be at least 3 total p tags in your HTML code.", + "testString": + "assert($(\"p\") && $(\"p\").length > 2, 'Create a new p element around your a element. There should be at least 3 total p tags in your HTML code.');" }, { - "text": "Your a element should be nested within your new p element.", - "testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().is(\"p\") || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().is(\"p\")), 'Your a element should be nested within your new p element.');" + "text": + "Your a element should be nested within your new p element.", + "testString": + "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().is(\"p\") || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().is(\"p\")), 'Your a element should be nested within your new p element.');" }, { - "text": "Your p element should have the text \"View more \" (with a space after it).", - "testString": "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi) || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi)), 'Your p element should have the text \"View more \" (with a space after it).');" + "text": + "Your p element should have the text \"View more \" (with a space after it).", + "testString": + "assert(($(\"a[href=\\\"http://freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi) || $(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi)), 'Your p element should have the text \"View more \" (with a space after it).');" }, { - "text": "Your a element should not have the text \"View more\".", - "testString": "assert(!$(\"a\").text().match(/View\\smore/gi), 'Your a element should not have the text \"View more\".');" + "text": + "Your a element should not have the text \"View more\".", + "testString": + "assert(!$(\"a\").text().match(/View\\smore/gi), 'Your a element should not have the text \"View more\".');" }, { - "text": "Make sure each of your p elements has a closing tag.", - "testString": "assert(code.match(/<\\/p>/g) && code.match(/

/g).length === code.match(/

p elements has a closing tag.');" + "text": + "Make sure each of your p elements has a closing tag.", + "testString": + "assert(code.match(/<\\/p>/g) && code.match(/

/g).length === code.match(/

p elements has a closing tag.');" }, { - "text": "Make sure each of your a elements has a closing tag.", - "testString": "assert(code.match(/<\\/a>/g) && code.match(//g).length === code.match(/a elements has a closing tag.');" + "text": + "Make sure each of your a elements has a closing tag.", + "testString": + "assert(code.match(/<\\/a>/g) && code.match(//g).length === code.match(/a elements has a closing tag.');" } ], "challengeType": 0, @@ -1107,8 +1192,10 @@ ], "tests": [ { - "text": "Your a element should be a dead link with the value of the href attribute set to \"#\".", - "testString": "assert($(\"a\").attr(\"href\") === \"#\", 'Your a element should be a dead link with the value of the href attribute set to \"#\".');" + "text": + "Your a element should be a dead link with the value of the href attribute set to \"#\".", + "testString": + "assert($(\"a\").attr(\"href\") === \"#\", 'Your a element should be a dead link with the value of the href attribute set to \"#\".');" } ], "challengeType": 0, @@ -1185,16 +1272,22 @@ ], "tests": [ { - "text": "Nest the existing img element within an a element.", - "testString": "assert($(\"a\").children(\"img\").length > 0, 'Nest the existing img element within an a element.');" + "text": + "Nest the existing img element within an a element.", + "testString": + "assert($(\"a\").children(\"img\").length > 0, 'Nest the existing img element within an a element.');" }, { - "text": "Your a element should be a dead link with a href attribute set to #.", - "testString": "assert(new RegExp(\"#\").test($(\"a\").children(\"img\").parent().attr(\"href\")), 'Your a element should be a dead link with a href attribute set to #.');" + "text": + "Your a element should be a dead link with a href attribute set to #.", + "testString": + "assert(new RegExp(\"#\").test($(\"a\").children(\"img\").parent().attr(\"href\")), 'Your a element should be a dead link with a href attribute set to #.');" }, { - "text": "Make sure each of your a elements has a closing tag.", - "testString": "assert(code.match(/<\\/a>/g) && code.match(//g).length === code.match(/a elements has a closing tag.');" + "text": + "Make sure each of your a elements has a closing tag.", + "testString": + "assert(code.match(/<\\/a>/g) && code.match(//g).length === code.match(/a elements has a closing tag.');" } ], "challengeType": 0, @@ -1281,19 +1374,24 @@ "tests": [ { "text": "Create a ul element.", - "testString": "assert($(\"ul\").length > 0, 'Create a ul element.');" + "testString": + "assert($(\"ul\").length > 0, 'Create a ul element.');" }, { - "text": "You should have three li elements within your ul element.", - "testString": "assert($(\"ul li\").length > 2, 'You should have three li elements within your ul element.');" + "text": + "You should have three li elements within your ul element.", + "testString": + "assert($(\"ul li\").length > 2, 'You should have three li elements within your ul element.');" }, { "text": "Make sure your ul element has a closing tag.", - "testString": "assert(code.match(/<\\/ul>/gi) && code.match(/