fix(challenge-md): Fix quotes that failed in the transform

This commit is contained in:
Bouncey
2018-10-08 01:01:53 +01:00
committed by mrugesh mohapatra
parent 392b28fa55
commit a859035023
1333 changed files with 5710 additions and 5710 deletions

View File

@ -29,7 +29,7 @@ For the cat with the "id" of 2, print to the console the second value in the <co
```yml
tests:
- text: 'Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.'
testString: 'assert(code.match(/(?:json\[2\]\.codeNames\[1\]|json\[2\]\[(''|")codeNames\1\]\[1\])/g), ''Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.'');'
testString: 'assert(code.match(/(?:json\[2\]\.codeNames\[1\]|json\[2\]\[("|")codeNames\1\]\[1\])/g), "Your code should use bracket and dot notation to access the proper code name, and print "Loki" to the console.");'
```
@ -51,8 +51,8 @@ tests:
json=JSON.parse(req.responseText);
document.getElementsByClassName('message')[0].innerHTML=JSON.stringify(json);
// Add your code below this line
// Add your code above this line
};
};
@ -84,7 +84,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -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\.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.");'
```
@ -39,8 +39,8 @@ tests:
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('getMessage').onclick=function(){
// Add your code below this line
// Add your code above this line
}
});
@ -71,7 +71,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -27,11 +27,11 @@ Here is some example JSON
```yml
tests:
- text: Your code should store the data in the <code>html</code> variable
testString: 'assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g), ''Your code should store the data in the <code>html</code> variable'');'
testString: 'assert(code.match(/html\s+?(\+=|=\shtml\s\+)/g), "Your code should store the data in the <code>html</code> variable");'
- text: Your code should use a <code>forEach</code> method to loop over the JSON data from the API.
testString: 'assert(code.match(/json\.forEach/g), ''Your code should use a <code>forEach</code> method to loop over the JSON data from the API.'');'
testString: 'assert(code.match(/json\.forEach/g), "Your code should use a <code>forEach</code> method to loop over the JSON data from the API.");'
- text: Your code should wrap the key names in <code>strong</code> tags.
testString: 'assert(code.match(/<strong>.+<\/strong>/g), ''Your code should wrap the key names in <code>strong</code> tags.'');'
testString: 'assert(code.match(/<strong>.+<\/strong>/g), "Your code should wrap the key names in <code>strong</code> tags.");'
```
@ -53,9 +53,9 @@ tests:
json=JSON.parse(req.responseText);
var html = "";
// Add your code below this line
// Add your code above this line
document.getElementsByClassName('message')[0].innerHTML=html;
};
@ -88,7 +88,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -26,13 +26,13 @@ Add the example code inside the <code>script</code> tags to check a user's curre
```yml
tests:
- text: 'Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.'
testString: 'assert(code.match(/navigator\.geolocation\.getCurrentPosition/g), ''Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.'');'
testString: 'assert(code.match(/navigator\.geolocation\.getCurrentPosition/g), "Your code should use <code>navigator.geolocation</code> to access the user&#39;s current location.");'
- text: 'Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.'
testString: 'assert(code.match(/position\.coords\.latitude/g), ''Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.'');'
testString: 'assert(code.match(/position\.coords\.latitude/g), "Your code should use <code>position.coords.latitude</code> to display the user&#39;s latitudinal location.");'
- text: 'Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.'
testString: 'assert(code.match(/position\.coords\.longitude/g), ''Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.'');'
testString: 'assert(code.match(/position\.coords\.longitude/g), "Your code should use <code>position.coords.longitude</code> to display the user&#39;s longitudinal location.");'
- text: 'You should display the user&#39;s position within the <code>data</code> div element.'
testString: 'assert(code.match(/document\.getElementById\(\s*?(''|")data\1\s*?\)\.innerHTML/g), ''You should display the user&#39;s position within the <code>data</code> div element.'');'
testString: 'assert(code.match(/document\.getElementById\(\s*?("|")data\1\s*?\)\.innerHTML/g), "You should display the user&#39;s position within the <code>data</code> div element.");'
```
@ -46,8 +46,8 @@ tests:
```html
<script>
// Add your code below this line
// Add your code above this line
</script>
<h4>You are here:</h4>

View File

@ -30,17 +30,17 @@ Update the code to create and send a "GET" request to the freeCodeCamp Cat Photo
```yml
tests:
- text: Your code should create a new <code>XMLHttpRequest</code>.
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), ''Your code should create a new <code>XMLHttpRequest</code>.'');'
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
- text: Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.
testString: 'assert(code.match(/\.open\(\s*?(''|")GET\1\s*?,\s*?(''|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), ''Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.'');'
testString: 'assert(code.match(/\.open\(\s*?("|")GET\1\s*?,\s*?("|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.");'
- text: Your code should use the <code>send</code> method to send the request.
testString: 'assert(code.match(/\.send\(\s*\)/g), ''Your code should use the <code>send</code> method to send the request.'');'
testString: 'assert(code.match(/\.send\(\s*\)/g), "Your code should use the <code>send</code> method to send the request.");'
- 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*?{/g), ''Your code should have an <code>onload</code> event handler set to a function.'');'
testString: 'assert(code.match(/\.onload\s*=\s*function\(\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\.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\.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.");'
```
@ -56,8 +56,8 @@ tests:
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('getMessage').onclick=function(){
// Add your code below this line
// Add your code above this line
};
});
@ -88,7 +88,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -23,9 +23,9 @@ 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\.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.'');'
testString: 'assert(typeof document.getElementById("getMessage").onclick === "function", "Your code should add an <code>onclick</code> event handler.");'
```
@ -40,8 +40,8 @@ tests:
<script>
document.addEventListener('DOMContentLoaded',function(){
// Add your code below this line
// Add your code above this line
});
</script>
@ -71,7 +71,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -26,17 +26,17 @@ Update the code to create and send a "POST" request. Then enter your name in inp
```yml
tests:
- text: Your code should create a new <code>XMLHttpRequest</code>.
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), ''Your code should create a new <code>XMLHttpRequest</code>.'');'
testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");'
- text: Your code should use the <code>open</code> method to initialize a "POST" request to the server.
testString: 'assert(code.match(/\.open\(\s*?(''|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), ''Your code should use the <code>open</code> method to initialize a "POST" request to the server.'');'
testString: 'assert(code.match(/\.open\(\s*?("|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "POST" request to the server.");'
- text: Your code should use the <code>setRequestHeader</code> method.
testString: 'assert(code.match(/\.setRequestHeader\(\s*?(''|")Content-Type\1\s*?,\s*?(''|")text\/plain\2\s*?\)/g), ''Your code should use the <code>setRequestHeader</code> method.'');'
testString: 'assert(code.match(/\.setRequestHeader\(\s*?("|")Content-Type\1\s*?,\s*?("|")text\/plain\2\s*?\)/g), "Your code should use the <code>setRequestHeader</code> method.");'
- text: Your code should have an <code>onreadystatechange</code> event handler set to a function.
testString: 'assert(code.match(/\.onreadystatechange\s*?=/g), ''Your code should have an <code>onreadystatechange</code> event handler set to a function.'');'
testString: 'assert(code.match(/\.onreadystatechange\s*?=/g), "Your code should have an <code>onreadystatechange</code> event handler set to a function.");'
- text: Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?(''|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), ''Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.'');'
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the <code>responseText</code>.");'
- text: Your code should use the <code>send</code> method.
testString: 'assert(code.match(/\.send\(\s*?userName\s*?\)/g), ''Your code should use the <code>send</code> method.'');'
testString: 'assert(code.match(/\.send\(\s*?userName\s*?\)/g), "Your code should use the <code>send</code> method.");'
```
@ -51,11 +51,11 @@ tests:
<script>
document.addEventListener('DOMContentLoaded',function(){
document.getElementById('sendMessage').onclick=function(){
var userName=document.getElementById('name').value;
// Add your code below this line
// Add your code above this line
};
});
@ -86,7 +86,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Friends</h1>
<h1>Cat Friends</h1>
<p class="message box">
Reply from Server will be here
</p>

View File

@ -23,7 +23,7 @@ Add code to <code>filter</code> the json data to remove the cat with the "id" va
```yml
tests:
- text: Your code should use the <code>filter</code> method.
testString: 'assert(code.match(/json\.filter/g), ''Your code should use the <code>filter</code> method.'');'
testString: 'assert(code.match(/json\.filter/g), "Your code should use the <code>filter</code> method.");'
```
@ -45,19 +45,19 @@ tests:
json=JSON.parse(req.responseText);
var html = "";
// Add your code below this line
// Add your code above this line
json.forEach(function(val) {
html += "<div class = 'cat'>"
html += "<img src = '" + val.imageLink + "' " + "alt='" + val.altText + "'>"
html += "</div>"
});
document.getElementsByClassName('message')[0].innerHTML=html;
};
};
};
});
</script>
<style>
@ -86,7 +86,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>

View File

@ -23,7 +23,7 @@ Add code to use the <code>imageLink</code> and <code>altText</code> properties i
```yml
tests:
- text: You should use the <code>imageLink</code> property to display the images.
testString: 'assert(code.match(/val\.imageLink/g), ''You should use the <code>imageLink</code> property to display the images.'');'
testString: 'assert(code.match(/val\.imageLink/g), "You should use the <code>imageLink</code> property to display the images.");'
```
@ -47,8 +47,8 @@ tests:
json.forEach(function(val) {
html += "<div class = 'cat'>";
// Add your code below this line
// Add your code above this line
html += "</div><br>";
});
@ -83,7 +83,7 @@ tests:
border: 1px solid #0F5897;
}
</style>
<h1>Cat Photo Finder</h1>
<h1>Cat Photo Finder</h1>
<p class="message box">
The message will go here
</p>