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

@@ -32,4 +32,8 @@ test("hydration", async ({ page }) => {
// Make sure the error that was thrown on the server is shown in the error boundary on the client
const errors = page.locator("#errors");
await expect(errors).toContainText("Hmm, something went wrong.");
// 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");
});