// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`challenge parser it should not parse directives we do not use 1`] = `
Object {
"description": "
:root appears, :import appears
the next paragraph should appear
::import
even though it's an import directive, but if we use the full syntax ::directive-name{attr=\\"name\\" attr2=\\"a/path\\"}
it goes.
::: name [inline-content] {key=val}
a container directive
:::
",
"solutions": Array [],
"tests": Array [],
}
`;
exports[`challenge parser it should parse video questions 1`] = `
Object {
"description": "",
"instructions": "
Paragraph 0
code example 0
",
"question": Object {
"answers": Array [
"
Some inline code
",
"Some italics
A second answer paragraph.
",
" code in
code tags
",
],
"solution": 3,
"text": "Question line 1
var x = 'y';
",
},
"solutions": Array [],
"tests": Array [],
}
`;
exports[`challenge parser should import md from other files 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
",
"editableRegionBoundaries": Array [],
"ext": "html",
"head": "",
"id": "",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: green;
}",
"editableRegionBoundaries": Array [],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';
for (let index = 0; index < array.length; index++) {
const element = array[index];
// imported from script.md
}",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": "",
"id": "custom-name",
"name": "script",
"tail": "",
},
],
"description": "",
"instructions": "
Paragraph 0
code example 0
",
"solutions": Array [],
"tests": Array [
Object {
"testString": "// test code",
"text": "First hint
",
},
Object {
"testString": "// more test code",
"text": "Second hint with code
",
},
],
}
`;
exports[`challenge parser should not mix other YAML with the frontmatter 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
",
"editableRegionBoundaries": Array [],
"ext": "html",
"head": "",
"id": "",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: green;
}",
"editableRegionBoundaries": Array [],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
"description": "
Paragraph 1
code example
key:
- subkey: value
anothersubkey: another value
",
"instructions": "
Paragraph 0
code example 0
",
"solutions": Array [],
"tests": Array [
Object {
"testString": "// test code",
"text": "First hint
",
},
Object {
"testString": "// more test code",
"text": "Second hint with code
",
},
],
}
`;
exports[`challenge parser should parse a more realistic md file 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
CatPhotoApp
",
"editableRegionBoundaries": Array [
19,
23,
],
"ext": "html",
"head": "",
"id": "html-key",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: white;
}
h1 {
font-size: 20px;
}
a {
color: green;
}",
"editableRegionBoundaries": Array [
7,
9,
],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": " // this runs before the user's code is evaluated.",
"id": "final-key",
"name": "script",
"tail": "",
},
],
"description": "
When you add a lower rank heading element to the page, it's implied that you're starting a new subsection.
After the last h2
element of the second section
element, add an h3
element with the text Things cats love:
.
Some text in a blockquote
Some text in a blockquote, with code
",
"instructions": "
Do something with the code
.
To test that adjacent tags are handled correctly:
a bit of code
with more after a space and another pair of elements with a space
",
"solutions": Array [
Array [
Object {
"contents": "
CatPhotoApp
",
"ext": "html",
"head": "",
"id": "html-key",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: white;
}
h1 {
font-size: 20px;
}
a {
color: green;
}",
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"ext": "js",
"head": "",
"id": "final-key",
"name": "script",
"tail": "",
},
],
],
"tests": Array [
Object {
"testString": "assert(
document.querySelectorAll('main > section')[1] &&
code.match(/\\\\<\\\\/section>/g).length == 2
);",
"text": "The second section
element appears to be missing or does not have both an opening and closing tag.
",
},
Object {
"testString": "assert(
document.querySelectorAll('main > section')[1].lastElementChild.nodeName ===
'H3'
);",
"text": "There should be an h3
element right above the second section
element's closing tag.
",
},
Object {
"testString": "assert(
document
.querySelectorAll('main > section')[1]
.lastElementChild.innerText.toLowerCase()
.replace(/\\\\s+/g, ' ') === 'things cats love:'
);",
"text": "The h3
element right above the second section
element's closing tag should have the text Things cats love:
. Make sure to include the colon at the end of the text.
",
},
Object {
"testString": "const secondSectionLastElemNode = document.querySelectorAll('main > section')[1]
.lastElementChild;
assert(
secondSectionLastElemNode.nodeName === 'H3' &&
secondSectionLastElemNode.previousElementSibling.innerText
.toLowerCase()
.replace(/\\\\s+/g, ' ') === 'cat lists'
);",
"text": "There should be an h2
element with the text Cat Lists
above the last h3
element that is nested in the last section
element'. You may have accidentally deleted the h2
element.
",
},
],
}
`;
exports[`challenge parser should parse a simple md file 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
",
"editableRegionBoundaries": Array [],
"ext": "html",
"head": "",
"id": "",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: green;
}",
"editableRegionBoundaries": Array [],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
"description": "",
"instructions": "
Paragraph 0
code example 0
",
"solutions": Array [
Array [
Object {
"contents": "
",
"ext": "html",
"head": "",
"id": "html-key",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: white;
}",
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';
\`\`",
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
],
"tests": Array [
Object {
"testString": "// test code",
"text": "First hint
",
},
Object {
"testString": "// more test code",
"text": "Second hint with code
",
},
Object {
"testString": "// more test code
if(let x of xs) {
console.log(x);
}",
"text": "Third hint with code
and inline code
",
},
],
}
`;
exports[`challenge parser should parse frontmatter 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
",
"editableRegionBoundaries": Array [],
"ext": "html",
"head": "",
"id": "",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: green;
}",
"editableRegionBoundaries": Array [],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
"challengeType": 0,
"description": "",
"forumTopicId": 18276,
"id": "bd7123c8c441eddfaeb5bdef",
"isHidden": false,
"solutions": Array [],
"tests": Array [
Object {
"testString": "// test code",
"text": "First hint
",
},
Object {
"testString": "// more test code",
"text": "Second hint with code
",
},
],
"title": "Say Hello to HTML Elements",
"videoUrl": "https://scrimba.com/p/pVMPUv/cE8Gpt2",
}
`;
exports[`challenge parser should parse gfm strikethrough and frontmatter 1`] = `
Object {
"challengeFiles": Array [
Object {
"contents": "
",
"editableRegionBoundaries": Array [],
"ext": "html",
"head": "",
"id": "",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: green;
}",
"editableRegionBoundaries": Array [],
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';",
"editableRegionBoundaries": Array [],
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
"description": "
Paragraph 1 Strikethrough text. https://should.not.be.autolinked
code example
",
"instructions": "
Paragraph 0
code example 0
",
"solutions": Array [
Array [
Object {
"contents": "
",
"ext": "html",
"head": "",
"id": "html-key",
"name": "index",
"tail": "",
},
Object {
"contents": "body {
background: white;
}",
"ext": "css",
"head": "",
"id": "",
"name": "styles",
"tail": "",
},
Object {
"contents": "var x = 'y';
\`\`",
"ext": "js",
"head": "",
"id": "",
"name": "script",
"tail": "",
},
],
],
"tests": Array [
Object {
"testString": "// test code",
"text": "First hint
",
},
Object {
"testString": "// more test code",
"text": "Second hint with code
",
},
Object {
"testString": "// more test code
if(let x of xs) {
console.log(x);
}",
"text": "Third hint with code
and inline code
",
},
],
}
`;