From 702da9bfad98c1fdd418c51376729afbcdfc01cc Mon Sep 17 00:00:00 2001 From: haveyaseen Date: Sun, 2 May 2021 15:44:46 +0200 Subject: [PATCH] add test for hydration of nested element with expression sibling --- .../samples/expression-sibling/_after.html | 1 + .../samples/expression-sibling/_before.html | 1 + .../samples/expression-sibling/_config.js | 19 +++++++++++++++++++ .../samples/expression-sibling/main.svelte | 1 + 4 files changed, 22 insertions(+) create mode 100644 test/hydration/samples/expression-sibling/_after.html create mode 100644 test/hydration/samples/expression-sibling/_before.html create mode 100644 test/hydration/samples/expression-sibling/_config.js create mode 100644 test/hydration/samples/expression-sibling/main.svelte diff --git a/test/hydration/samples/expression-sibling/_after.html b/test/hydration/samples/expression-sibling/_after.html new file mode 100644 index 0000000000..9c0a0b5778 --- /dev/null +++ b/test/hydration/samples/expression-sibling/_after.html @@ -0,0 +1 @@ +

1 2 3

diff --git a/test/hydration/samples/expression-sibling/_before.html b/test/hydration/samples/expression-sibling/_before.html new file mode 100644 index 0000000000..9c0a0b5778 --- /dev/null +++ b/test/hydration/samples/expression-sibling/_before.html @@ -0,0 +1 @@ +

1 2 3

diff --git a/test/hydration/samples/expression-sibling/_config.js b/test/hydration/samples/expression-sibling/_config.js new file mode 100644 index 0000000000..9cc0554776 --- /dev/null +++ b/test/hydration/samples/expression-sibling/_config.js @@ -0,0 +1,19 @@ +export default { + snapshot(target) { + const p = target.querySelector("p"); + + return { + p, + text: p.childNodes[0], + span: p.querySelector("span"), + }; + }, + + test(assert, target, snapshot) { + const p = target.querySelector("p"); + + assert.equal(p, snapshot.p); + assert.equal(p.childNodes[0], snapshot.text); + assert.equal(p.querySelector("span"), snapshot.span); + }, +}; diff --git a/test/hydration/samples/expression-sibling/main.svelte b/test/hydration/samples/expression-sibling/main.svelte new file mode 100644 index 0000000000..65aa541e9c --- /dev/null +++ b/test/hydration/samples/expression-sibling/main.svelte @@ -0,0 +1 @@ +

{1} 2 3