Fix onmounted event triggering many times (#3346)

* Fix event handler diffing

* Add headless tests for the onmounted event

* fix typo triggerd -> triggered
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-12-17 15:21:15 -08:00
1 parent 01c5716128
commit c0e01f99af
8 files changed
+126 -38

No files matched your search

+8
View File
@@ -107,3 +107,11 @@ test("prevent default", async ({ page }) => {
// Check that the <a> element changed.
await expect(a).toHaveText("Psych!");
});
test("onmounted", async ({ page }) => {
await page.goto("http://localhost:9999");
// Expect the onmounted event to be called exactly once.
const mountedDiv = page.locator("div.onmounted-div");
await expect(mountedDiv).toHaveText("onmounted was called 1 times");
});