fix: add test for an empty section
This commit is contained in:
@ -12,8 +12,6 @@ Object {
|
|||||||
<p><pre><code class=\\"language-html\\"><p>We aim to preserve this</p>
|
<p><pre><code class=\\"language-html\\"><p>We aim to preserve this</p>
|
||||||
</code></pre></p>
|
</code></pre></p>
|
||||||
</section>",
|
</section>",
|
||||||
"instructions": "<section id=\\"instructions\\">
|
"instructions": "",
|
||||||
<p>To pass the test on this challenge, change your <code>h1</code> element's text to say \\"Hello World\\".</p>
|
|
||||||
</section>",
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -397,80 +397,6 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"value": "\n"
|
"value": "\n"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "element",
|
|
||||||
"tagName": "p",
|
|
||||||
"properties": {},
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"value": "To pass the test on this challenge, change your ",
|
|
||||||
"position": {
|
|
||||||
"start": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 1,
|
|
||||||
"offset": 489
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 49,
|
|
||||||
"offset": 537
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "element",
|
|
||||||
"tagName": "code",
|
|
||||||
"properties": {},
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"value": "h1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"position": {
|
|
||||||
"start": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 49,
|
|
||||||
"offset": 537
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 53,
|
|
||||||
"offset": 541
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"value": " element's text to say \"Hello World\".",
|
|
||||||
"position": {
|
|
||||||
"start": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 53,
|
|
||||||
"offset": 541
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 90,
|
|
||||||
"offset": 578
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"position": {
|
|
||||||
"start": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 1,
|
|
||||||
"offset": 489
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 27,
|
|
||||||
"column": 90,
|
|
||||||
"offset": 578
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"value": "\n"
|
"value": "\n"
|
||||||
|
@ -54,6 +54,13 @@ describe('text-to-data', () => {
|
|||||||
expect(file.data[expectedField].includes(expectedText)).toBe(true);
|
expect(file.data[expectedField].includes(expectedText)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
it('should add an empty string relating to the section id without data to `file.data`', () => {
|
||||||
|
const plugin = textToData([otherExpectedField]);
|
||||||
|
plugin(mockAST, file);
|
||||||
|
expect(file.data[otherExpectedField]).toEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
it('should preserve nested html', () => {
|
it('should preserve nested html', () => {
|
||||||
const plugin = textToData([expectedField]);
|
const plugin = textToData([expectedField]);
|
||||||
plugin(mockAST, file);
|
plugin(mockAST, file);
|
||||||
|
Reference in New Issue
Block a user