add test, fix SSR

pull/13072/head
Rich Harris 2 years ago
parent 43a28f3097
commit 01fc6c5fd6

@ -5,6 +5,7 @@ import { hash } from '../../../utils.js';
* @param {string} value
*/
export function html(value) {
var open = DEV ? `<!--${hash(String(value ?? ''))}-->` : '<!---->';
return `${open}${value}<!---->`;
var html = String(value ?? '');
var open = DEV ? `<!--${hash(html)}-->` : '<!---->';
return open + html + '<!---->';
}

@ -303,7 +303,7 @@ async function run_test_variant(
config.withoutNormalizeHtml === 'only-strip-comments' ? false : undefined,
withoutNormalizeHtml: !!config.withoutNormalizeHtml
});
} else if (config.html) {
} else if (config.html !== undefined) {
assert_html_equal_with_options(target.innerHTML, config.html, {
preserveComments:
config.withoutNormalizeHtml === 'only-strip-comments' ? false : undefined,
@ -369,7 +369,7 @@ async function run_test_variant(
assert.fail('Expected a runtime error');
}
if (config.html) {
if (config.html !== undefined) {
flushSync();
assert_html_equal_with_options(target.innerHTML, config.html, {
preserveComments:

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: ''
});
Loading…
Cancel
Save