fix: removed assert msg argument (#36405)

This commit is contained in:
Randell Dawson
2019-07-24 02:42:26 -07:00
committed by Oliver Eyton-Williams
parent 1fa0dcb1e1
commit e763330fc3
69 changed files with 178 additions and 178 deletions

View File

@@ -26,7 +26,7 @@ Camper Cat happens to be both a coding ninja and an actual ninja, who is buildin
```yml
tests:
- text: Your <code>img</code> tag should have an <code>alt</code> attribute and it should not be empty.
testString: assert($('img').attr('alt'), 'Your <code>img</code> tag should have an <code>alt</code> attribute and it should not be empty.');
testString: assert($('img').attr('alt'));
```

View File

@@ -30,13 +30,13 @@ Camper Cat is setting up a Mortal Kombat tournament and wants to ask his competi
```yml
tests:
- text: Your code should add one <code>input</code> tag for the date selector field.
testString: assert($('input').length == 2, 'Your code should add one <code>input</code> tag for the date selector field.');
testString: assert($('input').length == 2);
- text: Your <code>input</code> tag should have a <code>type</code> attribute with a value of date.
testString: assert($('input').attr('type') == 'date', 'Your <code>input</code> tag should have a <code>type</code> attribute with a value of date.');
testString: assert($('input').attr('type') == 'date');
- text: Your <code>input</code> tag should have an <code>id</code> attribute with a value of pickdate.
testString: assert($('input').attr('id') == 'pickdate', 'Your <code>input</code> tag should have an <code>id</code> attribute with a value of pickdate.');
testString: assert($('input').attr('id') == 'pickdate');
- text: Your <code>input</code> tag should have a <code>name</code> attribute with a value of date.
testString: assert($('input').attr('name') == 'date', 'Your <code>input</code> tag should have a <code>name</code> attribute with a value of date.');
testString: assert($('input').attr('name') == 'date');
```

View File

@@ -23,7 +23,7 @@ Camper Cat is testing different styles for an important button, but the yellow (
```yml
tests:
- text: Your code should change the text <code>color</code> for the <code>button</code> to the dark blue.
testString: assert($('button').css('color') == 'rgb(0, 51, 102)', 'Your code should change the text <code>color</code> for the <code>button</code> to the dark blue.');
testString: assert($('button').css('color') == 'rgb(0, 51, 102)');
```

View File

@@ -24,9 +24,9 @@ Camper Cat is experimenting with using color for his blog text and background, b
```yml
tests:
- text: Your code should only change the lightness value for the text <code>color</code> property to a value of 15%.
testString: assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi), 'Your code should only change the lightness value for the text <code>color</code> property to a value of 15%.');
testString: assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));
- text: Your code should only change the lightness value for the <code>background-color</code> property to a value of 55%.
testString: assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi), 'Your code should only change the lightness value for the <code>background-color</code> property to a value of 55%.');
testString: assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));
```

View File

@@ -22,9 +22,9 @@ The link text that Camper Cat is using is not very descriptive without the surro
```yml
tests:
- text: Your code should move the anchor <code>a</code> tags from around the words "Click here" to wrap around the words "information about batteries".
testString: assert($('a').text().match(/^(information about batteries)$/g), 'Your code should move the anchor <code>a</code> tags from around the words "Click here" to wrap around the words "information about batteries".');
testString: assert($('a').text().match(/^(information about batteries)$/g));
- text: Make sure your <code>a</code> element has a closing tag.
testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a href=(''|"")>/g).length, 'Make sure your <code>a</code> element has a closing tag.');
testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a href=(''|"")>/g).length);
```

View File

@@ -33,19 +33,19 @@ Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax),
```yml
tests:
- text: Your code should have one <code>audio</code> tag.
testString: assert($('audio').length === 1, 'Your code should have one <code>audio</code> tag.');
testString: assert($('audio').length === 1);
- text: Make sure your <code>audio</code> element has a closing tag.
testString: assert(code.match(/<\/audio>/g).length === 1 && code.match(/<audio.*>[\s\S]*<\/audio>/g), 'Make sure your <code>audio</code> element has a closing tag.');
testString: assert(code.match(/<\/audio>/g).length === 1 && code.match(/<audio.*>[\s\S]*<\/audio>/g));
- text: The <code>audio</code> tag should have the <code>controls</code> attribute.
testString: assert($('audio').attr('controls'), 'The <code>audio</code> tag should have the <code>controls</code> attribute.');
testString: assert($('audio').attr('controls'));
- text: Your code should have one <code>source</code> tag.
testString: assert($('source').length === 1, 'Your code should have one <code>source</code> tag.');
testString: assert($('source').length === 1);
- text: Your <code>source</code> tag should be inside the <code>audio</code> tags.
testString: assert($('audio').children('source').length === 1, 'Your <code>source</code> tag should be inside the <code>audio</code> tags.');
testString: assert($('audio').children('source').length === 1);
- text: The value for the <code>src</code> attribute on the <code>source</code> tag should match the link in the instructions exactly.
testString: assert($('source').attr('src') === 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3', 'The value for the <code>src</code> attribute on the <code>source</code> tag should match the link in the instructions exactly.');
testString: assert($('source').attr('src') === 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3');
- text: Your code should include a <code>type</code> attribute on the <code>source</code> tag with a value of audio/mpeg.
testString: assert($('source').attr('type') === 'audio/mpeg', 'Your code should include a <code>type</code> attribute on the <code>source</code> tag with a value of audio/mpeg.');
testString: assert($('source').attr('type') === 'audio/mpeg');
```

View File

@@ -34,17 +34,17 @@ Camper Cat is hard at work creating a stacked bar chart showing the amount of ti
```yml
tests:
- text: Your code should have one <code>figure</code> tag.
testString: assert($('figure').length == 1, 'Your code should have one <code>figure</code> tag.');
testString: assert($('figure').length == 1);
- text: Your code should have one <code>figcaption</code> tag.
testString: assert($('figcaption').length == 1, 'Your code should have one <code>figcaption</code> tag.');
testString: assert($('figcaption').length == 1);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
- text: Your code should not have any <code>p</code> tags.
testString: assert($('p').length == 0, 'Your code should not have any <code>p</code> tags.');
testString: assert($('p').length == 0);
- text: The <code>figcaption</code> should be a child of the <code>figure</code> tag.
testString: assert($('figure').children('figcaption').length == 1, 'The <code>figcaption</code> should be a child of the <code>figure</code> tag.');
testString: assert($('figure').children('figcaption').length == 1);
- text: Make sure your <code>figure</code> element has a closing tag.
testString: assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(/<figure>/g).length, 'Make sure your <code>figure</code> element has a closing tag.');
testString: assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(/<figure>/g).length);
```

View File

@@ -32,9 +32,9 @@ Camper Cat expects a lot of interest in his thoughtful blog posts and wants to i
```yml
tests:
- text: Your code should have a <code>for</code> attribute on the <code>label</code> tag that is not empty.
testString: assert($('label').attr('for'), 'Your code should have a <code>for</code> attribute on the <code>label</code> tag that is not empty.');
testString: assert($('label').attr('for'));
- text: Your <code>for</code> attribute value should match the <code>id</code> value on the email <code>input</code>.
testString: assert($('label').attr('for') == 'email', 'Your <code>for</code> attribute value should match the <code>id</code> value on the email <code>input</code>.');
testString: assert($('label').attr('for') == 'email');
```

View File

@@ -22,9 +22,9 @@ Camper Cat's choice of light gray text on a white background for his recent blog
```yml
tests:
- text: Your code should change the text <code>color</code> for the <code>body</code> to the darker gray.
testString: assert($('body').css('color') == 'rgb(99, 99, 99)', 'Your code should change the text <code>color</code> for the <code>body</code> to the darker gray.');
testString: assert($('body').css('color') == 'rgb(99, 99, 99)');
- text: Your code should not change the <code>background-color</code> for the <code>body</code>.
testString: assert($('body').css('background-color') == 'rgb(255, 255, 255)', 'Your code should not change the <code>background-color</code> for the <code>body</code>.');
testString: assert($('body').css('background-color') == 'rgb(255, 255, 255)');
```

View File

@@ -24,9 +24,9 @@ Camper Cat has some big ideas for his ninja weapons page. Help him set up his ma
```yml
tests:
- text: Your code should have one <code>main</code> tag.
testString: assert($('main').length == 1, 'Your code should have one <code>main</code> tag.');
testString: assert($('main').length == 1);
- text: The <code>main</code> tags should be between the closing <code>header</code> tag and the opening <code>footer</code> tag.
testString: assert(code.match(/<\/header>\s*?<main>\s*?<\/main>/gi), 'The <code>main</code> tags should be between the closing <code>header</code> tag and the opening <code>footer</code> tag.');
testString: assert(code.match(/<\/header>\s*?<main>\s*?<\/main>/gi));
```

View File

@@ -25,9 +25,9 @@ Camper Cat has coded a skeleton page for the blog part of his website. He's plan
```yml
tests:
- text: Your <code>img</code> tag should have an <code>alt</code> attribute.
testString: assert(!($('img').attr('alt') == undefined), 'Your <code>img</code> tag should have an <code>alt</code> attribute.');
testString: assert(!($('img').attr('alt') == undefined));
- text: The <code>alt</code> attribute should be set to an empty string.
testString: assert($('img').attr('alt') == '', 'The <code>alt</code> attribute should be set to an empty string.');
testString: assert($('img').attr('alt') == '');
```

View File

@@ -40,13 +40,13 @@ Camper Cat created a really cool stacked bar chart for his training page, and pu
```yml
tests:
- text: Your code should set the <code>position</code> property of the <code>sr-only</code> class to a value of absolute.
testString: assert($('.sr-only').css('position') == 'absolute', 'Your code should set the <code>position</code> property of the <code>sr-only</code> class to a value of absolute.');
testString: assert($('.sr-only').css('position') == 'absolute');
- text: Your code should set the <code>left</code> property of the <code>sr-only</code> class to a value of -10000px.
testString: assert($('.sr-only').css('left') == '-10000px', 'Your code should set the <code>left</code> property of the <code>sr-only</code> class to a value of -10000px.');
testString: assert($('.sr-only').css('left') == '-10000px');
- text: Your code should set the <code>width</code> property of the <code>sr-only</code> class to a value of 1 pixel.
testString: assert(code.match(/width:\s*?1px/gi), 'Your code should set the <code>width</code> property of the <code>sr-only</code> class to a value of 1 pixel.');
testString: assert(code.match(/width:\s*?1px/gi));
- text: Your code should set the <code>height</code> property of the <code>sr-only</code> class to a value of 1 pixel.
testString: assert(code.match(/height:\s*?1px/gi), 'Your code should set the <code>height</code> property of the <code>sr-only</code> class to a value of 1 pixel.');
testString: assert(code.match(/height:\s*?1px/gi));
```

View File

@@ -24,13 +24,13 @@ Camper Cat wants the links around the two blog article titles to have keyboard s
```yml
tests:
- text: Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "first".
testString: assert($('#first').attr('accesskey'), 'Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "first".');
testString: assert($('#first').attr('accesskey'));
- text: Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "second".
testString: assert($('#second').attr('accesskey'), 'Your code should add an <code>accesskey</code> attribute to the <code>a</code> tag with the <code>id</code> of "second".');
testString: assert($('#second').attr('accesskey'));
- text: Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "first" to "g". Note that case matters.
testString: assert($('#first').attr('accesskey') == 'g', 'Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "first" to "g". Note that case matters.');
testString: assert($('#first').attr('accesskey') == 'g');
- text: Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "second" to "c". Note that case matters.
testString: assert($('#second').attr('accesskey') == 'c', 'Your code should set the <code>accesskey</code> attribute on the <code>a</code> tag with the <code>id</code> of "second" to "c". Note that case matters.');
testString: assert($('#second').attr('accesskey') == 'c');
```

View File

@@ -21,11 +21,11 @@ Camper Cat's training page is making good progress. Change the <code>div</code>
```yml
tests:
- text: Your code should have one <code>footer</code> tag.
testString: assert($('footer').length == 1, 'Your code should have one <code>footer</code> tag.');
testString: assert($('footer').length == 1);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
- text: Your code should have an opening and closing <code>footer</code> tag.
testString: assert(code.match(/<footer>\s*&copy; 2018 Camper Cat\s*<\/footer>/g), 'Your code should have an opening and closing <code>footer</code> tag.');
testString: assert(code.match(/<footer>\s*&copy; 2018 Camper Cat\s*<\/footer>/g));
```

View File

@@ -23,13 +23,13 @@ Camper Cat is writing some great articles about ninja training, and wants to add
```yml
tests:
- text: Your code should have one <code>header</code> tag.
testString: assert($('header').length == 1, 'Your code should have one <code>header</code> tag.');
testString: assert($('header').length == 1);
- text: Your <code>header</code> tags should wrap around the <code>h1</code>.
testString: assert($('header').children('h1').length == 1, 'Your <code>header</code> tags should wrap around the <code>h1</code>.');
testString: assert($('header').children('h1').length == 1);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
- text: Make sure your <code>header</code> element has a closing tag.
testString: assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(/<header>/g).length, 'Make sure your <code>header</code> element has a closing tag.');
testString: assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(/<header>/g).length);
```

View File

@@ -22,13 +22,13 @@ Camper Cat included navigation links at the top of his training page, but wrappe
```yml
tests:
- text: Your code should have one <code>nav</code> tag.
testString: assert($('nav').length == 1, 'Your code should have one <code>nav</code> tag.');
testString: assert($('nav').length == 1);
- text: Your <code>nav</code> tags should wrap around the <code>ul</code> and its list items.
testString: assert($('nav').children('ul').length == 1, 'Your <code>nav</code> tags should wrap around the <code>ul</code> and its list items.');
testString: assert($('nav').children('ul').length == 1);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
- text: Make sure your <code>nav</code> element has a closing tag.
testString: assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/<nav>/g).length, 'Make sure your <code>nav</code> element has a closing tag.');
testString: assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/<nav>/g).length);
```

View File

@@ -26,13 +26,13 @@ Camper Cat wants a page on his site dedicated to becoming a ninja. Help him fix
```yml
tests:
- text: Your code should have 6 <code>h3</code> tags.
testString: assert($("h3").length === 6, 'Your code should have 6 <code>h3</code> tags.');
testString: assert($("h3").length === 6);
- text: Your code should have 6 <code>h3</code> closing tags.
testString: assert((code.match(/\/h3/g) || []).length===6,'Your code should have 6 <code>h3</code> closing tags.');
testString: assert((code.match(/\/h3/g) || []).length===6);
- text: Your code should not have any <code>h5</code> tags.
testString: assert($("h5").length === 0, "Your code should not have any <code>h5</code> tags.");
- text: Your code should not have any <code>h5</code> closing tags.
testString: assert(/\/h5/.test(code)===false, 'Your code should not have any <code>h5</code> closing tags');
testString: assert(/\/h5/.test(code)===false);
```
</section>

View File

@@ -24,9 +24,9 @@ Camper Cat created a new survey to collect information about his users. He knows
```yml
tests:
- text: Your code should add a <code>tabindex</code> attribute to the <code>p</code> tag that holds the form instructions.
testString: assert($('p').attr('tabindex'), 'Your code should add a <code>tabindex</code> attribute to the <code>p</code> tag that holds the form instructions.');
testString: assert($('p').attr('tabindex'));
- text: Your code should set the <code>tabindex</code> attribute on the <code>p</code> tag to a value of 0.
testString: assert($('p').attr('tabindex') == '0', 'Your code should set the <code>tabindex</code> attribute on the <code>p</code> tag to a value of 0.');
testString: assert($('p').attr('tabindex') == '0');
```

View File

@@ -26,13 +26,13 @@ Camper Cat has a search field on his Inspirational Quotes page that he plans to
```yml
tests:
- text: Your code should add a <code>tabindex</code> attribute to the search <code>input</code> tag.
testString: assert($('#search').attr('tabindex'), 'Your code should add a <code>tabindex</code> attribute to the search <code>input</code> tag.');
testString: assert($('#search').attr('tabindex'));
- text: Your code should add a <code>tabindex</code> attribute to the submit <code>input</code> tag.
testString: assert($('#submit').attr('tabindex'), 'Your code should add a <code>tabindex</code> attribute to the submit <code>input</code> tag.');
testString: assert($('#submit').attr('tabindex'));
- text: Your code should set the <code>tabindex</code> attribute on the search <code>input</code> tag to a value of 1.
testString: assert($('#search').attr('tabindex') == '1', 'Your code should set the <code>tabindex</code> attribute on the search <code>input</code> tag to a value of 1.');
testString: assert($('#search').attr('tabindex') == '1');
- text: Your code should set the <code>tabindex</code> attribute on the submit <code>input</code> tag to a value of 2.
testString: assert($('#submit').attr('tabindex') == '2', 'Your code should set the <code>tabindex</code> attribute on the submit <code>input</code> tag to a value of 2.');
testString: assert($('#submit').attr('tabindex') == '2');
```

View File

@@ -31,9 +31,9 @@ Camper Cat used <code>article</code> tags to wrap the posts on his blog page, bu
```yml
tests:
- text: Your code should have three <code>article</code> tags.
testString: assert($('article').length == 3, 'Your code should have three <code>article</code> tags.');
testString: assert($('article').length == 3);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
```

View File

@@ -39,15 +39,15 @@ Camper Cat wants information about the ninja level of his users when they sign u
```yml
tests:
- text: Your code should have a <code>fieldset</code> tag around the radio button set.
testString: assert($('fieldset').length == 1, 'Your code should have a <code>fieldset</code> tag around the radio button set.');
testString: assert($('fieldset').length == 1);
- text: Make sure your <code>fieldset</code> element has a closing tag.
testString: assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length, 'Make sure your <code>fieldset</code> element has a closing tag.');
testString: assert(code.match(/<\/fieldset>/g) && code.match(/<\/fieldset>/g).length === code.match(/<fieldset>/g).length);
- text: Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.
testString: assert($('legend').length == 1, 'Your code should have a <code>legend</code> tag around the text asking what level ninja a user is.');
testString: assert($('legend').length == 1);
- text: Your code should not have any <code>div</code> tags.
testString: assert($('div').length == 0, 'Your code should not have any <code>div</code> tags.');
testString: assert($('div').length == 0);
- text: Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is.
testString: assert($('p').length == 4, 'Your code should no longer have a <code>p</code> tag around the text asking what level ninja a user is.');
testString: assert($('p').length == 4);
```