Fix/tests whitespace strictness (#36706)

* fix(tests): make less strict about white space
This commit is contained in:
Tom
2019-08-28 03:53:17 -05:00
committed by Oliver Eyton-Williams
parent 46d67deb46
commit 428ab97650
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ Log the message <code>'Now I know React and Redux!'</code> to the console.
```yml ```yml
tests: tests:
- text: The message <code>Now I know React and Redux!</code> should be logged to the console. - text: The message <code>Now I know React and Redux!</code> should be logged to the console.
testString: getUserInput => assert(/console.log\(("|')Now I know React and Redux!\1\)/.test(getUserInput('index'))); testString: getUserInput => assert(/console\s*\.\s*log\s*\(\s*('|"|`)Now I know React and Redux!\1\s*\)/.test(getUserInput('index')));
``` ```

View File

@ -49,7 +49,7 @@ tests:
- text: Your code should have an <code>onload</code> event handler set to a function. - text: Your code should have an <code>onload</code> event handler set to a function.
testString: assert(code.match(/\.onload\s*=\s*(function|\(\s*?\))\s*?(\(\s*?\)|\=\>)\s*?{/g)); testString: assert(code.match(/\.onload\s*=\s*(function|\(\s*?\))\s*?(\(\s*?\)|\=\>)\s*?{/g));
- text: Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>. - text: Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.
testString: assert(code.match(/JSON\s*\.parse\(.*\.responseText\)/g)); testString: assert(code.match(/JSON\s*\.parse\(\s*.*\.responseText\s*\)/g));
- text: Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data. - text: Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.
testString: assert(code.match(/document\s*\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\s*\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g)); testString: assert(code.match(/document\s*\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\s*\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g));