[Fix] allow line breaks between method calls for several Data Visualization challenges (#35093)
* fix: allow spaces between lines breaks a function arguments * fix: allow line breaks between method calls
This commit is contained in:
committed by
Christopher McCormack
parent
603585e39e
commit
bc99876f9e
@ -23,7 +23,7 @@ Add code inside the <code>onclick</code> event handler to change the text inside
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.
|
||||
testString: assert(code.match(/document\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.textContent\s*?=\s*?('|")Here is the message\2/g), 'Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.');
|
||||
testString: assert(code.match(/document\s*\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\s*\.textContent\s*?=\s*?('|")Here is the message\2/g), 'Your code should use the <code>document.getElementsByClassName</code> method to select the element with class <code>message</code> and set its <code>textContent</code> to the given string.');
|
||||
|
||||
```
|
||||
|
||||
|
@ -38,9 +38,9 @@ tests:
|
||||
- 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*?{/g), 'Your code should have an <code>onload</code> event handler set to a function.');
|
||||
- text: Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.
|
||||
testString: assert(code.match(/JSON\.parse\(.*\.responseText\)/g), '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), 'Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.');
|
||||
- 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\.getElementsByClassName\(\s*?('|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), '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), 'Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.');
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,7 +23,7 @@ Add a click event handler inside of the <code>DOMContentLoaded</code> function f
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.
|
||||
testString: assert(code.match(/document\.getElementById\(\s*?('|")getMessage\1\s*?\)/g), 'Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.');
|
||||
testString: assert(code.match(/document\s*\.getElementById\(\s*?('|")getMessage\1\s*?\)/g), 'Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.');
|
||||
- text: Your code should add an <code>onclick</code> event handler.
|
||||
testString: assert(typeof document.getElementById('getMessage').onclick === 'function', 'Your code should add an <code>onclick</code> event handler.');
|
||||
|
||||
|
Reference in New Issue
Block a user