{"id":18996961,"url":"https://github.com/rburgst/preact-testing-animation-bug","last_synced_at":"2026-06-23T22:01:32.498Z","repository":{"id":145057832,"uuid":"536659601","full_name":"rburgst/preact-testing-animation-bug","owner":"rburgst","description":"repo showing a problem in `@testing-library/preact\": \"^3.2.2\"`","archived":false,"fork":false,"pushed_at":"2022-09-14T16:15:23.000Z","size":1764,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T16:44:57.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rburgst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-14T16:07:53.000Z","updated_at":"2022-09-14T16:08:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"1544c778-e791-4811-9ebd-cc4d2f375075","html_url":"https://github.com/rburgst/preact-testing-animation-bug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fpreact-testing-animation-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fpreact-testing-animation-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fpreact-testing-animation-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fpreact-testing-animation-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rburgst","download_url":"https://codeload.github.com/rburgst/preact-testing-animation-bug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240011739,"owners_count":19733758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T17:37:43.341Z","updated_at":"2026-04-16T17:30:19.594Z","avatar_url":"https://github.com/rburgst.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sample repo that shows a problem where `fireEvent.animationEnd` does not work for a preact component.\n\nSee also https://github.com/testing-library/preact-testing-library/issues/67\n\nTo reproduce \n\n```\nyarn install\nyarn test\n```\n\nNote that all tests are green\n\nnow change the version of `@testing-library/preact\": \"^3.2.2\"`\n\n```\nyarn install\nyarn test\n```\n\nNote that the test fails now.\n\n## Details\n\nThe following does not work\n\n```typescript\nexport interface TestComponentProps {\n  onNextClick?: () =\u003e void;\n}\n\nexport const TestComponent: FunctionComponent\u003cTestComponentProps\u003e = ({\n  onNextClick,\n}) =\u003e {\n  return (\n    \u003cdiv data-countdown onAnimationEnd={onNextClick}\u003e\n      FOO\n    \u003c/div\u003e\n  );\n};\n\n```\n\nand the corresponding test\n```typescript\n\n  it(\"should call onNextClick on animation end\", async () =\u003e {\n    //given\n    const props = {\n      onNextClick: jest.fn(),\n    };\n\n    //when\n    const { container } = render(\u003cTestComponent {...props} /\u003e);\n\n    fireEvent.animationEnd(\n      container.querySelector(\"[data-countdown]\") as HTMLElement\n    );\n\n    //then\n    expect(props.onNextClick).toHaveBeenCalledTimes(1);\n  });\n```\n\nThe problem appears that the listeners in jsdom are registered with `AnimationEnd` while the event being fired is `animationend`.\n\nNote that this worked in `@testing-library/preact\": \"^2.0.1\"` but fails with the current version `3.2.2`.\n\nScreenshot of the listeners in jsdoms `EventTarget-impl.js` `invokeEventListeners`\n![img.png](doc/img.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frburgst%2Fpreact-testing-animation-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frburgst%2Fpreact-testing-animation-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frburgst%2Fpreact-testing-animation-bug/lists"}