diff --git a/test/hydration/samples/dynamic-text-nil/_after.html b/test/hydration/samples/dynamic-text-nil/_after.html new file mode 100644 index 0000000000..817637990b --- /dev/null +++ b/test/hydration/samples/dynamic-text-nil/_after.html @@ -0,0 +1,2 @@ +
+undefined
diff --git a/test/hydration/samples/dynamic-text-nil/_before.html b/test/hydration/samples/dynamic-text-nil/_before.html new file mode 100644 index 0000000000..b20e4a8074 --- /dev/null +++ b/test/hydration/samples/dynamic-text-nil/_before.html @@ -0,0 +1,2 @@ +null
+undefined
diff --git a/test/hydration/samples/dynamic-text-nil/_config.js b/test/hydration/samples/dynamic-text-nil/_config.js new file mode 100644 index 0000000000..0f98a704b0 --- /dev/null +++ b/test/hydration/samples/dynamic-text-nil/_config.js @@ -0,0 +1,21 @@ +export default { + props: {}, + + snapshot(target) { + const nullText = target.querySelectorAll('p')[0].textContent; + const undefinedText = target.querySelectorAll('p')[1].textContent; + + return { + nullText, + undefinedText, + }; + }, + + test(assert, target, snapshot) { + const nullText = target.querySelectorAll('p')[0].textContent; + const undefinedText = target.querySelectorAll('p')[1].textContent; + + assert.equal(nullText, snapshot.nullText); + assert.equal(undefinedText, snapshot.undefinedText); + }, +}; diff --git a/test/hydration/samples/dynamic-text-nil/main.svelte b/test/hydration/samples/dynamic-text-nil/main.svelte new file mode 100644 index 0000000000..853faa635c --- /dev/null +++ b/test/hydration/samples/dynamic-text-nil/main.svelte @@ -0,0 +1,7 @@ + + +{maybeNull}
+{maybeUndefined}