From ee8e15059692502756abef8a0008116e5ab8ee43 Mon Sep 17 00:00:00 2001 From: Paul Shippy Date: Sun, 28 Jul 2024 21:57:41 -0700 Subject: [PATCH] Failing tests for #1288 --- src/tests/unit/stream_element_tests.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/tests/unit/stream_element_tests.js b/src/tests/unit/stream_element_tests.js index 0d3e04b61..03d706647 100644 --- a/src/tests/unit/stream_element_tests.js +++ b/src/tests/unit/stream_element_tests.js @@ -157,6 +157,17 @@ test("action=after", async () => { assert.isNull(element.parentElement) }) + +test("action=after with children ID already present in target", async () => { + subject.fixtureHTML = `
Top
Middle
Bottom
` + const element = createStreamElement("after", "top", createTemplateElement('
New Middle
tail1 ')) + + subject.append(element) + await nextAnimationFrame() + + assert.equal(subject.find("#hello")?.textContent, "Top New Middle tail1 Bottom") +}) + test("action=before", async () => { const element = createStreamElement("before", "hello", createTemplateElement(`

Before Turbo

`)) assert.equal(subject.find("#hello")?.textContent, "Hello Turbo") @@ -170,6 +181,17 @@ test("action=before", async () => { assert.isNull(element.parentElement) }) + +test("action=before with children ID already present in target", async () => { + subject.fixtureHTML = `
Top
Middle
Bottom
` + const element = createStreamElement("before", "bottom", createTemplateElement('
New Middle
tail1 ')) + + subject.append(element) + await nextAnimationFrame() + + assert.equal(subject.find("#hello")?.textContent, "Top New Middle tail1 Bottom") +}) + test("test action=refresh", async () => { document.body.setAttribute("data-modified", "") assert.ok(document.body.hasAttribute("data-modified"))