{"id":21307447,"url":"https://github.com/jdegand/testing-checkbox","last_synced_at":"2026-05-06T22:37:15.596Z","repository":{"id":233468762,"uuid":"688234997","full_name":"jdegand/testing-checkbox","owner":"jdegand","description":"Angular Challenges #28 Checkbox Testing","archived":false,"fork":false,"pushed_at":"2023-09-07T00:02:40.000Z","size":141,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T19:49:14.812Z","etag":null,"topics":["angular","angular-challenges","jest","testing-library"],"latest_commit_sha":null,"homepage":"","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/jdegand.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":"2023-09-07T00:00:48.000Z","updated_at":"2023-09-13T00:33:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f193b7a-6f8c-454b-a148-9309be3ecbb9","html_url":"https://github.com/jdegand/testing-checkbox","commit_stats":null,"previous_names":["jdegand/testing-checkbox"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdegand/testing-checkbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Ftesting-checkbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Ftesting-checkbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Ftesting-checkbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Ftesting-checkbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdegand","download_url":"https://codeload.github.com/jdegand/testing-checkbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdegand%2Ftesting-checkbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32715426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T19:35:05.142Z","status":"ssl_error","status_checked_at":"2026-05-06T19:35:03.996Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["angular","angular-challenges","jest","testing-library"],"created_at":"2024-11-21T16:32:02.827Z","updated_at":"2026-05-06T22:37:15.582Z","avatar_url":"https://github.com/jdegand.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testing Checkbox\n\n[Angular Challenges](https://github.com/tomalaforge/angular-challenges) #28 Checkbox Testing\n\n## Built With\n\n- [Angular](https://angular.io)\n- [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.\n\n## Directions\n\nThis is the perfect example to get started with `Testing Library`.\n\nYou will need to only check if the button gets enabled when clicking on the checkbox\n\nYou can look into debug function to get full power of `Testing Library` like:\n\n- logRoles(...);\n- screen.debug(); // you can pass a element as input\n- screen.logTestingPlaygroundURL(); // you can pass a element as input\n\n## Thoughts\n\n- You can add @testing-library to an angular app with karma and jasmine and it will work without extra configuration.  \n- However, @testing-library/user-event appears to have issues.  \n- userEvent may have an await bug.  See [Github](https://github.com/testing-library/user-event/issues/1103) for more. \n- fireEvent works no problem with same code structure.  \n- I can't get userEvent to work.   \n- I did not double install @testing-library/dom.\n- I tried invoking view.detectChanges() after the click to no avail. (const view = await render(appComponent))\n- I also tried wrapping the click event with waitFor but that failed as well.\n- So I decided to install jest and remove karma and jasmine.  \n- I think testing with jest is easier anyway as you don't have to cast to HTMLButtonElement with jest.\n- jasmine doesn't have a toBeEnabled() equivalent ?\n- I didn't have to rewrite tests after the switch and it seems to work fine.  \n- I will try to mix user-event with testing-library, karma and jasmine in the future. \n- `Property 'toBeChecked' does not exist on type 'JestMatchers\u003cHTMLElement\u003e'` error when trying to use toBeChecked().  Need to add more dependencies for jest to fully work ? \n- Added @tesing-library/jest-dom and made other adjustments -\u003e very flaky -\u003e it initially worked until it errored out with no tests being run\n- Something could be off.  Angular's official support for jest can't come soon enough.  Google needs to do a total overhaul of this.  As of now, it is a minefield of nagging issues.  Packages also need to be more explicit about if types are necessary or not.\n- See [Github](https://github.com/testing-library/jest-dom/issues/442) for more.  \n- ng test won't work -\u003e need to use npm test.\n\n## Useful Resources\n\n- [YouTube](https://www.youtube.com/watch?v=OB-XAj6Ef_A) - Angular with testing-library\n- [Stack Overflow](https://stackoverflow.com/questions/41382831/how-to-unit-test-the-checkbox-in-angular2) - how to unit test the checkbox in angular2\n- [Github](https://github.com/testing-library/angular-testing-library/tree/main/apps/example-app/src/app/examples) - testing library angular examples\n- [Stack Overflow](https://stackoverflow.com/questions/73232927/react-testing-userevent-click-does-not-work) - userEvent click does not work\n- [Github](https://github.com/testing-library/user-event/issues/1103) - user event issues \n- [Testing Library Docs](https://testing-library.com/docs/ecosystem-jasmine-dom/) - ecosystem jasmine dom\n- [Medium](https://medium.com/@megha.d.parmar2018/angular-unit-testing-with-jest-2023-2676faa2e564) - angular unit testing with jest -\u003e error -\u003e ts-node should be dev dependency  \n- [Github](https://github.com/testing-library/jest-dom/issues/442) - toBeChecked() issues","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdegand%2Ftesting-checkbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdegand%2Ftesting-checkbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdegand%2Ftesting-checkbox/lists"}