Skip to content

Commit ca18d8a

Browse files
committed
update tests
1 parent 3fc818f commit ca18d8a

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

packages/svelte/tests/html_equal.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ export function setup_html_equal(options = {}) {
135135
try {
136136
assert.deepEqual(
137137
withoutNormalizeHtml
138-
? normalize_new_line(actual)
138+
? normalize_new_line(actual.trim())
139139
.replace(/(\sdata-svelte-h="[^"]+")/g, options.removeDataSvelte ? '' : '$1')
140140
.replace(/(<!(--)?.*?\2>)/g, preserveComments !== false ? '$1' : '')
141-
: normalize_html(window, actual, { ...options, preserveComments }),
141+
: normalize_html(window, actual.trim(), { ...options, preserveComments }),
142142
withoutNormalizeHtml
143-
? normalize_new_line(expected)
143+
? normalize_new_line(expected.trim())
144144
.replace(/(\sdata-svelte-h="[^"]+")/g, options.removeDataSvelte ? '' : '$1')
145145
.replace(/(<!(--)?.*?\2>)/g, preserveComments !== false ? '$1' : '')
146-
: normalize_html(window, expected, { ...options, preserveComments }),
146+
: normalize_html(window, expected.trim(), { ...options, preserveComments }),
147147
message
148148
);
149149
} catch (e) {

packages/svelte/tests/runtime-legacy/samples/pre-tag/_config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function get_html(ssr) {
1212
// ssr rendered HTML has an extra newline prefixed within `<pre>` tag,
1313
// if the <pre> tag starts with `\n`
1414
// because when browser parses the SSR rendered HTML, it will ignore the 1st '\n' character
15-
return `${ssr ? '<!--ssr:0-->' : ''}<pre id="pre"> A
15+
return `${ssr ? '<!--[-->' : ''}<pre id="pre"> A
1616
B
1717
<span>
1818
C
@@ -35,5 +35,5 @@ function get_html(ssr) {
3535
leading newlines</pre></div> <div id="pre-without-leading-newline"><pre>without spaces</pre> <pre> with spaces </pre> <pre>${' '}
3636
newline after leading space</pre></div> <pre id="pre-with-multiple-leading-newlines">
3737
38-
multiple leading newlines</pre>${ssr ? '<!--ssr:0-->' : ''}`;
38+
multiple leading newlines</pre>${ssr ? '<!--]-->' : ''}`;
3939
}

packages/svelte/tests/runtime-legacy/samples/raw-anchor-first-child/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default test({
1111
if (variant === 'dom') {
1212
assert.ok(!span.previousSibling);
1313
} else {
14-
assert.ok(span.previousSibling?.textContent?.startsWith('ssr:')); // ssr commment node
14+
assert.ok(span.previousSibling?.textContent === '['); // ssr commment node
1515
}
1616

1717
component.raw = '<span>bar</span>';

packages/svelte/tests/runtime-legacy/samples/textarea-content/_config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ export default test({
44
withoutNormalizeHtml: true,
55
// Unable to test `html` with `<textarea>` content
66
// as the textarea#value will not show within `innerHtml`
7-
ssrHtml: `<!--ssr:0--><textarea id="textarea"> A
7+
ssrHtml: `<!--[--><textarea id="textarea"> A
88
B
99
</textarea> <div id="div-with-textarea"><textarea> A
1010
B
1111
</textarea></div> <div id="textarea-with-leading-newline"><textarea>leading newline</textarea> <textarea> leading newline and spaces</textarea> <textarea>
12-
leading newlines</textarea></div> <div id="textarea-without-leading-newline"><textarea>without spaces</textarea> <textarea> with spaces </textarea> <textarea>
12+
leading newlines</textarea></div> <div id="textarea-without-leading-newline"><textarea>without spaces</textarea> <textarea> with spaces </textarea> <textarea>${' '}
1313
newline after leading space</textarea></div> <textarea id="textarea-with-multiple-leading-newlines">
1414
1515
multiple leading newlines</textarea> <div id="div-with-textarea-with-multiple-leading-newlines"><textarea>
1616
17-
multiple leading newlines</textarea></div><!--ssr:0-->`,
17+
multiple leading newlines</textarea></div><!--]-->`,
1818
test({ assert, target }) {
1919
// Test for <textarea> tag
2020
const elementTextarea = /** @type {HTMLTextAreaElement} */ (target.querySelector('#textarea'));
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
<!--ssr:0-->
2-
<p>before</p>
3-
<!-- a comment -->
4-
<p>after</p>
5-
<!--ssr:0-->
1+
<![><p>before</p><!-- a comment --><p>after</p><!]>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!ssr:0><div>Just a dummy page.</div><!ssr:0>
1+
<![><div>Just a dummy page.</div><!]>

0 commit comments

Comments
 (0)