|
|
|
|
@ -6,23 +6,14 @@ export default {
|
|
|
|
|
const elementDiv = target.querySelector('#div');
|
|
|
|
|
// Test for <pre> tag in non <pre> tag
|
|
|
|
|
const elementDivWithPre = target.querySelector('#div-with-pre');
|
|
|
|
|
|
|
|
|
|
// There is a slight difference in innerHTML because there is a difference in HTML optimization (in jsdom)
|
|
|
|
|
// depending on how the innerHTML is set.
|
|
|
|
|
// (There is no difference in the display.)
|
|
|
|
|
// Reassign innerHTML to add the same optimizations to innerHTML.
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-self-assign
|
|
|
|
|
elementPre.innerHTML = elementPre.innerHTML;
|
|
|
|
|
// eslint-disable-next-line no-self-assign
|
|
|
|
|
elementDiv.innerHTML = elementDiv.innerHTML;
|
|
|
|
|
// eslint-disable-next-line no-self-assign
|
|
|
|
|
elementDivWithPre.innerHTML = elementDivWithPre.innerHTML;
|
|
|
|
|
// 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');
|
|
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
|
elementPre.innerHTML,
|
|
|
|
|
`
|
|
|
|
|
A
|
|
|
|
|
` A
|
|
|
|
|
B
|
|
|
|
|
<span>
|
|
|
|
|
C
|
|
|
|
|
@ -53,5 +44,12 @@ export default {
|
|
|
|
|
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');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|