-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
102 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,37 @@ | ||
export default { | ||
test({ assert, target }) { | ||
// Test for <pre> tag | ||
const elementPre = target.querySelector('#pre'); | ||
// Test for non <pre> tag | ||
const elementDiv = target.querySelector('#div'); | ||
// Test for <pre> tag in non <pre> tag | ||
const elementDivWithPre = target.querySelector('#div-with-pre'); | ||
// Test for <pre> tag with leading newline | ||
const elementPreWithLeadingNewline = target.querySelector('#pre-with-leading-newline'); | ||
const elementPreWithoutLeadingNewline = target.querySelector('#pre-without-leading-newline'); | ||
const elementPreWithMultipleLeadingNewline = target.querySelector('#pre-with-multiple-leading-newlines'); | ||
withoutNormalizeHtml: true, | ||
html: get_html(false), | ||
ssrHtml: get_html(true) | ||
}; | ||
|
||
assert.equal( | ||
elementPre.innerHTML, | ||
` A | ||
function get_html(ssr) { | ||
// ssr rendered HTML has an extra newline prefixed within `<pre>` tag, | ||
// if the <pre> tag starts with `\n` | ||
// because when browser parses the SSR rendered HTML, it will ignore the 1st '\n' character | ||
return `<pre id="pre"> A | ||
B | ||
<span> | ||
C | ||
D | ||
</span> | ||
E | ||
F | ||
` | ||
); | ||
assert.equal( | ||
elementDiv.innerHTML, | ||
`A | ||
</pre> <div id="div">A | ||
B | ||
<span>C | ||
D</span> | ||
E | ||
F` | ||
); | ||
assert.equal( | ||
elementDivWithPre.innerHTML, | ||
`<pre> A | ||
F</div> <div id="div-with-pre"><pre> A | ||
B | ||
<span> | ||
C | ||
D | ||
</span> | ||
E | ||
F | ||
</pre>` | ||
); | ||
assert.equal(elementPreWithLeadingNewline.children[0].innerHTML, 'leading newline'); | ||
assert.equal(elementPreWithLeadingNewline.children[1].innerHTML, ' leading newline and spaces'); | ||
assert.equal(elementPreWithLeadingNewline.children[2].innerHTML, '\nleading newlines'); | ||
assert.equal(elementPreWithoutLeadingNewline.children[0].innerHTML, 'without spaces'); | ||
assert.equal(elementPreWithoutLeadingNewline.children[1].innerHTML, ' with spaces '); | ||
assert.equal(elementPreWithoutLeadingNewline.children[2].innerHTML, ' \nnewline after leading space'); | ||
assert.equal(elementPreWithMultipleLeadingNewline.innerHTML, '\n\nmultiple leading newlines'); | ||
} | ||
}; | ||
</pre></div> <div id="pre-with-leading-newline"><pre>leading newline</pre> <pre> leading newline and spaces</pre> <pre>${ssr ? '\n' : ''} | ||
leading newlines</pre></div> <div id="pre-without-leading-newline"><pre>without spaces</pre> <pre> with spaces </pre> <pre> | ||
newline after leading space</pre></div> <pre id="pre-with-multiple-leading-newlines">${ssr ? '\n' : ''} | ||
multiple leading newlines</pre>`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.