chore: Update a bunch of tests for hydration markers

pull/16762/head
S. Elliott Johnson 5 days ago
parent 26d6613bfc
commit e3b0f80b7c

@ -322,6 +322,12 @@ export class Boundary {
var onerror = this.#props.onerror;
let failed = this.#props.failed;
// If we have nothing to capture the error, or if we hit an error while
// rendering the fallback, re-throw for another boundary to handle
if (this.#is_creating_fallback || (!onerror && !failed)) {
throw error;
}
if (this.#main_effect) {
destroy_effect(this.#main_effect);
this.#main_effect = null;
@ -385,12 +391,6 @@ export class Boundary {
}
};
// If we have nothing to capture the error, or if we hit an error while
// rendering the fallback, re-throw for another boundary to handle
if (this.#is_creating_fallback || (!onerror && !failed)) {
throw error;
}
var previous_reaction = active_reaction;
try {

@ -220,8 +220,12 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
var unmount = component_root(() => {
var anchor_node = anchor ?? target.appendChild(create_text());
branch(() => {
boundary(/** @type {TemplateNode} */ (anchor_node), { pending: () => {} }, (anchor_node) => {
boundary(
/** @type {TemplateNode} */ (anchor_node),
{
pending: () => {}
},
(anchor_node) => {
if (context) {
push({});
var ctx = /** @type {ComponentContext} */ (component_context);
@ -249,8 +253,8 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
if (context) {
pop();
}
});
});
}
);
return () => {
for (var event_name of registered_events) {

@ -1 +1 @@
<!--[--><input> <p>Hello world!</p><!--]-->
<!--[--><!--[--><input> <p>Hello world!</p><!--]--><!--]-->

@ -1 +1 @@
<!--[--> <p>start</p><!--[--><p>cond</p><!--]--><!--]-->
<!--[--><!--[--> <p>start</p><!--[--><p>cond</p><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><h1>Hello everybody!</h1><!--]-->
<!--[--><!--[--><h1>Hello everybody!</h1><!--]--><!--]-->

@ -1 +1 @@
<!--[--><ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--><!--]-->
<!--[--><!--[--><ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!--[!--><p>a</p><!--]--> <!--[--><p>empty</p><!--]--><!--]-->
<!--[--><!--[--><!--[!--><p>a</p><!--]--> <!--[--><p>empty</p><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--><!--]-->
<!--[--><!--[--><ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <ul><!--[--><li>a</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--> <!--[--><li>a</li> <li>a</li><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><ul><!--[--><li>a</li><li>b</li><!--]--></ul> <ul><!--[--><li>a</li><li>b</li><!--]--></ul> <ul><!--[--><li>a</li><li>b</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--><!--]-->
<!--[--><!--[--><ul><!--[--><li>a</li><li>b</li><!--]--></ul> <ul><!--[--><li>a</li><li>b</li><!--]--></ul> <ul><!--[--><li>a</li><li>b</li><!--]--></ul> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--> <!--[--><li>a</li> <li>a</li><li>b</li> <li>b</li><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><div class="bar"></div><!--]-->
<!--[--><!--[--><div class="bar"></div><!--]--><!--]-->

@ -1 +1 @@
<!--[--><div class="bar"></div><!--]-->
<!--[--><!--[--><div class="bar"></div><!--]--><!--]-->

@ -1 +1 @@
<!--[--><div></div> <!--[--><div></div> <div></div><!--]--><!--]-->
<!--[--><!--[--><div></div> <!--[--><div></div> <div></div><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!--[--><!--]--> <div><!----><!----></div> hello<!--]-->
<!--[--><!--[--><!--[--><!--]--> <div><!----><!----></div> hello<!--]--><!--]-->

@ -1 +1 @@
<!--[--><!--[!--><p>foo</p><!--]--><!--]-->
<!--[--><!--[--><!--[!--><p>foo</p><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!---->.<input><!--]-->
<!--[--><!--[--><!---->.<input><!--]--><!--]-->

@ -1 +1 @@
<!--[--><input type="text"><!--]-->
<!--[--><!--[--><input type="text"><!--]--><!--]-->

@ -1 +1 @@
<!--[--><noscript>JavaScript is required for this site.</noscript> <h1>Hello!</h1><p>Count: 1</p><!--]-->
<!--[--><!--[--><noscript>JavaScript is required for this site.</noscript> <h1>Hello!</h1><p>Count: 1</p><!--]--><!--]-->

@ -1,7 +1,7 @@
<!--[--><pre>static content no line</pre> <pre> static content ignored line
<!--[--><!--[--><pre>static content no line</pre> <pre> static content ignored line
</pre> <pre>
static content relevant line
</pre> <pre><div><span></span></div>
</pre> <pre>
<div><span></span></div>
</pre><!--]-->
</pre><!--]--><!--]-->

@ -1 +1 @@
<!--[--><div></div><!--]-->
<!--[--><!--[--><div></div><!--]--><!--]-->

@ -1 +1 @@
<!--[--><a href="/foo">foo</a> <a href="/foo">foo</a><!--]-->
<!--[--><!--[--><a href="/foo">foo</a> <a href="/foo">foo</a><!--]--><!--]-->

@ -1 +1 @@
<!--[--><h1>call <a href="tel:+636-555-3226">+636-555-3226</a> now<span>!</span></h1><!--]-->
<!--[--><!--[--><h1>call <a href="tel:+636-555-3226">+636-555-3226</a> now<span>!</span></h1><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!----><script>{}<!----></script><!----><!--]-->
<!--[--><!--[--><!----><script>{}<!----></script><!----><!--]--><!--]-->

@ -1 +1 @@
<!--[--><p>hydrated</p><!--]-->
<!--[--><!--[--><p>hydrated</p><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!--[--><p>child</p><!--]--> <!--[--><p>child</p><p>child</p><p>child</p><!--]--><!--]-->
<!--[--><!--[--><!--[--><p>child</p><!--]--> <!--[--><p>child</p><p>child</p><p>child</p><!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!--[--><p>thing</p><!--]--> <!--[--><p>thing</p><p>thing</p><p>thing</p><!--]--><!--]-->
<!--[--><!--[--><!--[--><p>thing</p><!--]--> <!--[--><p>thing</p><p>thing</p><p>thing</p><!--]--><!--]--><!--]-->

@ -1,2 +1,2 @@
<!-- unrelated comment -->
<!--[--><!--[-->hello<!--]--><!--]-->
<!--[--><!--[--><!--[-->hello<!--]--><!--]--><!--]-->

@ -1,2 +1,2 @@
<!-- unrelated comment -->
<!--[--><!--[-->hello<!--]--><!--]-->
<!--[--><!--[--><!--[-->hello<!--]--><!--]--><!--]-->

@ -1 +1 @@
<!--[--><span><span></span></span><!--]-->
<!--[--><!--[--><span><span></span></span><!--]--><!--]-->

@ -1 +1 @@
<!--[--><!---->x<!--]-->
<!--[--><!--[--><!---->x<!--]--><!--]-->

@ -1,2 +1,2 @@
<!--[-->
<main><p>nested</p><!----></main><!--]-->
<!--[--><!--[-->
<main><p>nested</p><!----></main><!--]--><!--]-->

@ -4,7 +4,7 @@ export default test({
withoutNormalizeHtml: true,
// Unable to test `html` with `<textarea>` content
// as the textarea#value will not show within `innerHtml`
ssrHtml: `<!--[--><textarea id="textarea"> A
ssrHtml: `<!--[--><!--[--><textarea id="textarea"> A
B
</textarea> <div id="div-with-textarea"><textarea> A
B
@ -14,7 +14,7 @@ newline after leading space</textarea></div> <textarea id="textarea-with-multipl
multiple leading newlines</textarea> <div id="div-with-textarea-with-multiple-leading-newlines"><textarea>
multiple leading newlines</textarea></div><!--]-->`,
multiple leading newlines</textarea></div><!--]--><!--]-->`,
test({ assert, target }) {
// Test for <textarea> tag
const elementTextarea = /** @type {HTMLTextAreaElement} */ (target.querySelector('#textarea'));

@ -398,17 +398,12 @@ async function run_test_variant(
};
} else {
const render = variant === 'hydrate' ? hydrate : mount;
// catch and log error from this function
try {
instance = render(mod.default, {
target,
props,
intro: config.intro,
recover: config.recover ?? false
});
} catch (error) {
console.log(error);
}
instance = render(mod.default, {
target,
props,
intro: config.intro,
recover: config.recover ?? false
});
}
} else {
instance = createClassComponent({

@ -1,6 +1,7 @@
import { test } from '../../test';
export default test({
skip_mode: ['hydrate', 'server'],
compileOptions: {
dev: true
},

@ -1 +1 @@
<!--[--><p>before</p><!-- a comment --><p>after</p><!--]-->
<!--[--><!--[--><p>before</p><!-- a comment --><p>after</p><!--]--><!--]-->

@ -1 +1 @@
<!--[--><div>Just a dummy page.</div><!--]-->
<!--[--><!--[--><div>Just a dummy page.</div><!--]--><!--]-->

@ -1,4 +1,5 @@
<!--[-->
<!--[-->
<!---->
<title>lorem</title>
<!---->
@ -15,3 +16,4 @@
</script>
<!---->
<!--]-->
<!--]-->

Loading…
Cancel
Save