From bc99876f9e294e6de30374ac8578ae1f668e8229 Mon Sep 17 00:00:00 2001
From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Date: Fri, 22 Feb 2019 11:18:10 -0800
Subject: [PATCH] [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
---
.../add-axes-to-a-visualization.english.md | 2 +-
.../change-text-with-click-events.english.md | 2 +-
...-json-with-the-javascript-xmlhttprequest-method.english.md | 4 ++--
...ents-with-javascript-using-the-onclick-property.english.md | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.english.md b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.english.md
index 1eb2e9b725..ed665660f7 100644
--- a/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.english.md
+++ b/curriculum/challenges/english/04-data-visualization/data-visualization-with-d3/add-axes-to-a-visualization.english.md
@@ -33,7 +33,7 @@ tests:
- text: The y-axis g
element should have a transform
attribute to translate the axis by (60, 0).
testString: assert($('g').eq(1).attr('transform').match(/translate\(60\s*?,\s*?0\)/g), 'The y-axis g
element should have a transform
attribute to translate the axis by (60, 0).');
- text: Your code should call the yAxis
.
- testString: assert(code.match(/\.call\(yAxis\)/g), 'Your code should call the yAxis
.');
+ testString: assert(code.match(/\.call\(\s*yAxis\s*\)/g), 'Your code should call the yAxis
.');
```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md
index a42d581814..d871b80a33 100644
--- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md
+++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/change-text-with-click-events.english.md
@@ -23,7 +23,7 @@ Add code inside the onclick
event handler to change the text inside
```yml
tests:
- text: Your code should use the document.getElementsByClassName
method to select the element with class message
and set its textContent
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 document.getElementsByClassName
method to select the element with class message
and set its textContent
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 document.getElementsByClassName
method to select the element with class message
and set its textContent
to the given string.');
```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md
index 8f649e3208..2deb30361d 100644
--- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md
+++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/get-json-with-the-javascript-xmlhttprequest-method.english.md
@@ -38,9 +38,9 @@ tests:
- text: Your code should have an onload
event handler set to a function.
testString: assert(code.match(/\.onload\s*=\s*function\s*?\(\s*?\)\s*?{/g), 'Your code should have an onload
event handler set to a function.');
- text: Your code should use the JSON.parse
method to parse the responseText
.
- testString: assert(code.match(/JSON\.parse\(.*\.responseText\)/g), 'Your code should use the JSON.parse
method to parse the responseText
.');
+ testString: assert(code.match(/JSON\s*\.parse\(.*\.responseText\)/g), 'Your code should use the JSON.parse
method to parse the responseText
.');
- text: Your code should get the element with class message
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 message
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 message
and change its inner HTML to the string of JSON data.');
```
diff --git a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md
index 8e9299e6f6..27ddd68b59 100644
--- a/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md
+++ b/curriculum/challenges/english/04-data-visualization/json-apis-and-ajax/handle-click-events-with-javascript-using-the-onclick-property.english.md
@@ -23,7 +23,7 @@ Add a click event handler inside of the DOMContentLoaded
function f
```yml
tests:
- text: Your code should use the document.getElementById
method to select the getMessage
element.
- testString: assert(code.match(/document\.getElementById\(\s*?('|")getMessage\1\s*?\)/g), 'Your code should use the document.getElementById
method to select the getMessage
element.');
+ testString: assert(code.match(/document\s*\.getElementById\(\s*?('|")getMessage\1\s*?\)/g), 'Your code should use the document.getElementById
method to select the getMessage
element.');
- text: Your code should add an onclick
event handler.
testString: assert(typeof document.getElementById('getMessage').onclick === 'function', 'Your code should add an onclick
event handler.');