{"id":15106930,"url":"https://github.com/davidlj95/angular-routerlinkactive-testing","last_synced_at":"2025-09-27T05:31:29.750Z","repository":{"id":240722614,"uuid":"803332309","full_name":"davidlj95/angular-routerlinkactive-testing","owner":"davidlj95","description":"Example of how to test an Angular's RouterLinkActive directive with best practices. Angular v17","archived":true,"fork":false,"pushed_at":"2024-05-20T15:33:44.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-21T14:31:39.640Z","etag":null,"topics":["angular","jasmine","routerlink","routerlinkactive","unit-testing"],"latest_commit_sha":null,"homepage":"https://stackoverflow.com/a/78507412/3263250","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/davidlj95.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":"2024-05-20T14:19:37.000Z","updated_at":"2024-05-23T17:03:07.000Z","dependencies_parsed_at":"2024-05-20T18:19:52.446Z","dependency_job_id":null,"html_url":"https://github.com/davidlj95/angular-routerlinkactive-testing","commit_stats":null,"previous_names":["davidlj95/angular-routerlinkactive-testing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-routerlinkactive-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-routerlinkactive-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-routerlinkactive-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-routerlinkactive-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidlj95","download_url":"https://codeload.github.com/davidlj95/angular-routerlinkactive-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871900,"owners_count":16554466,"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":["angular","jasmine","routerlink","routerlinkactive","unit-testing"],"created_at":"2024-09-25T21:03:25.393Z","updated_at":"2025-09-27T05:31:29.255Z","avatar_url":"https://github.com/davidlj95.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `RouterLinkActive` testing\n\nPurpose of this sample app is to answer to a [StackOverflow question](https://stackoverflow.com/questions/45013284/how-can-i-test-routerlinkactive-in-angular) about how to test apps using [Angular's `RouterLinkActive` directive](https://angular.dev/api/router/RouterLinkActive) in latest version of Angular (right now v17.3)\n\nSee complete explanation in the [StackOverflow's answer](https://stackoverflow.com/a/78507412/3263250)\n\nMain meat is in [sidebar component test](./src/app/side-bar/side-bar.component.spec.ts)\n\nYou can find an alternative solution that couples to the `RouterLink` directive APIs in [a separate branch](https://github.com/davidlj95/angular-routerlinkactive-testing/tree/using-router-directives)\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.7.\n\nSpecific command for creation:\n```shell\npnpm dlx @angular/cli@17.3.x new --package-manager=pnpm \\\n  --inline-style --inline-template \\\n  --no-ssr --style css routerlinkactive-testing\n```\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlj95%2Fangular-routerlinkactive-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidlj95%2Fangular-routerlinkactive-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlj95%2Fangular-routerlinkactive-testing/lists"}