Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(platform-browser): include Location mocks into testing environment by default #47413

Closed
wants to merge 1 commit into from

Commits on Oct 5, 2022

  1. feat(platform-browser): include Location mocks into testing environme…

    …nt by default
    
    Currently, the `Location` and `LocationStrategy` mocks are added by the Router's testing module (the `RouterTestingModule`). However, the `Location` and `LocationStrategy` abstractions are parts of the `@angular/common` package and can be used outside of the Router logic to interact with the location.
    
    This PR adds the `Location` and `LocationStrategy` mocks into the `BrowserTestingModule` NgModule, which is used for environment setup in TestBed. Adding the mocks there has 2 main advantages:
    
    - `Location` and `LocationStrategy` mocks will always be setup when you use TestBed (note: if you provide location mocks in the TestBed.configureTestingModule, custom mocks would still be used), which would cover cases when the `Location` is used in apps code directly.
    - The Router would not need to provide the mocks for abstractions that belong to the different package (`@angular/common`), which should help simplify the standalone Router APIs for testing.
    AndrewKushnir committed Oct 5, 2022
    Configuration menu
    Copy the full SHA
    18ef292 View commit details
    Browse the repository at this point in the history