{"id":16453432,"url":"https://github.com/blimmer/vue-jest-svg-issue","last_synced_at":"2025-06-11T17:02:46.114Z","repository":{"id":145469754,"uuid":"366527773","full_name":"blimmer/vue-jest-svg-issue","owner":"blimmer","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-11T22:38:09.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T20:43:03.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/blimmer.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":"2021-05-11T22:27:22.000Z","updated_at":"2021-05-11T22:38:11.000Z","dependencies_parsed_at":"2023-05-09T20:01:04.630Z","dependency_job_id":null,"html_url":"https://github.com/blimmer/vue-jest-svg-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blimmer/vue-jest-svg-issue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimmer%2Fvue-jest-svg-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimmer%2Fvue-jest-svg-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimmer%2Fvue-jest-svg-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimmer%2Fvue-jest-svg-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blimmer","download_url":"https://codeload.github.com/blimmer/vue-jest-svg-issue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimmer%2Fvue-jest-svg-issue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259301676,"owners_count":22836975,"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-10-11T10:15:37.548Z","updated_at":"2025-06-11T17:02:46.091Z","avatar_url":"https://github.com/blimmer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-jest-svg-issue\n\nThis repository demos an issue when trying to interact with a rendered SVG from `jest`.\n\n## Quick Start\n\n- Clone this repo\n- Run `npm ci` to install the dependencies\n- Run `npm run serve` and visit localhost:8080 on your local machine\n\nYou'll see that you can click on and interact with both buttons, as demonstrated in this gif:\n\n![](https://i.imgur.com/3zMZ2ua.gif)\n\n- Now, try running the test suite `npm run test`\n\nYou'll see that the regular button is clicked, and its counter incremented, but the SVG button does\nnot respond to the click.\n\n```console\n FAIL  src/components/Demo.test.js\n  ✓ can click the regular button (27 ms)\n  ✕ can click the svg button (7 ms)\n\n  ● can click the svg button\n\n    expect(received).toEqual(expected) // deep equality\n\n    Expected: \"SVG button clicked 1 times\"\n    Received: \"SVG button clicked 0 times\"\n\n      12 |   const demo = mount(Demo);\n      13 |   await demo.find('#svg-button').trigger('click');\n    \u003e 14 |   expect(demo.find('#svg-button-counter').text()).toEqual('SVG button clicked 1 times')\n         |                                                   ^\n      15 | })\n      16 |\n\n      at Object.\u003canonymous\u003e (src/components/Demo.test.js:14:51)\n\nTest Suites: 1 failed, 1 total\nTests:       1 failed, 1 passed, 2 total\nSnapshots:   0 total\nTime:        1.952 s, estimated 2 s\n```\n\n## Setup\n\nYou can see the source file at [`src/components/Demo.vue`](https://github.com/blimmer/vue-jest-svg-issue/blob/main/src/components/Demo.vue) and the test at [`src/components/Demo.test.js`](https://github.com/blimmer/vue-jest-svg-issue/blob/main/src/components/Demo.test.js).\n\nI'm transforming `svg` files according to the `vue-svg-loader` [documentation instructions](https://vue-svg-loader.js.org/faq.html#how-to-use-this-loader-with-jest).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblimmer%2Fvue-jest-svg-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblimmer%2Fvue-jest-svg-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblimmer%2Fvue-jest-svg-issue/lists"}