From f25d5cd0a9230293b9cc9c9d5a43f4d7582b5cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radan=20Skori=C4=87?= Date: Fri, 24 May 2024 16:33:13 +0200 Subject: [PATCH] Add a test that stream actions rendered into the HTML are executed As a consequence of the fundamental way in which Stream actions are implemented, they can also be executed by rendering them within any HTML that's included on the dom. Since this is already being used as the feature in the community, adding this test will ensure this keeps working. --- src/tests/functional/stream_tests.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/tests/functional/stream_tests.js b/src/tests/functional/stream_tests.js index 40f464d21..87cdc2658 100644 --- a/src/tests/functional/stream_tests.js +++ b/src/tests/functional/stream_tests.js @@ -182,6 +182,25 @@ test("receiving a remove stream message preserves focus blurs the activeElement" assert.notOk(await hasSelector(page, ":focus")) }) +test("rendering a stream message into the HTML executes it", async ({ page }) => { + await page.evaluate(() => { + document.body.insertAdjacentHTML( + "afterbegin", + ` + + + + ` + ) + }) + await nextBeat() + + const messages = await page.locator("#messages .message") + assert.deepEqual(await messages.allTextContents(), ["First", "Hello world!"]) +}) + async function getReadyState(page, id) { return page.evaluate((id) => { const element = document.getElementById(id)