refactor(core): Migrate TestBed.get to TestBed.inject (#32382)
This is cleanup/followup for PR #32200 PR Close #32382
This commit is contained in:
parent
a64eded521
commit
9166baf709
|
@ -28,9 +28,9 @@ describe('HeroesService', () => {
|
|||
|
||||
// Inject the http, test controller, and service-under-test
|
||||
// as they will be referenced by each test.
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
httpTestingController = TestBed.get(HttpTestingController);
|
||||
heroService = TestBed.get(HeroesService);
|
||||
httpClient = TestBed.inject(HttpClient);
|
||||
httpTestingController = TestBed.inject(HttpTestingController);
|
||||
heroService = TestBed.inject(HeroesService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -44,7 +44,7 @@ describe('HeroesService', () => {
|
|||
let expectedHeroes: Hero[];
|
||||
|
||||
beforeEach(() => {
|
||||
heroService = TestBed.get(HeroesService);
|
||||
heroService = TestBed.inject(HeroesService);
|
||||
expectedHeroes = [
|
||||
{ id: 1, name: 'A' },
|
||||
{ id: 2, name: 'B' },
|
||||
|
|
|
@ -27,8 +27,8 @@ describe('HttpClient testing', () => {
|
|||
});
|
||||
|
||||
// Inject the http service and test controller for each test
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
httpTestingController = TestBed.get(HttpTestingController);
|
||||
httpClient = TestBed.inject(HttpClient);
|
||||
httpTestingController = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
// #enddocregion setup
|
||||
// #docregion afterEach
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('MyLibService', () => {
|
|||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: MyLibService = TestBed.get(MyLibService);
|
||||
const service: MyLibService = TestBed.inject(MyLibService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -103,7 +103,7 @@ xdescribe('AppComponent & Lazy Loading (not working yet)', () => {
|
|||
|
||||
beforeEach(fakeAsync(() => {
|
||||
createComponent();
|
||||
loader = TestBed.get(NgModuleFactoryLoader);
|
||||
loader = TestBed.inject(NgModuleFactoryLoader);
|
||||
loader.stubbedModules = { expected: HeroModule };
|
||||
router.resetConfig([{path: 'heroes', loadChildren: 'expected'}]);
|
||||
}));
|
||||
|
|
|
@ -46,21 +46,21 @@ describe('demo (with TestBed):', () => {
|
|||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ providers: [ValueService] });
|
||||
// #enddocregion value-service-before-each
|
||||
service = TestBed.get(ValueService);
|
||||
service = TestBed.inject(ValueService);
|
||||
// #docregion value-service-before-each
|
||||
});
|
||||
// #enddocregion value-service-before-each, value-service-inject-before-each
|
||||
|
||||
// #docregion value-service-inject-it
|
||||
it('should use ValueService', () => {
|
||||
service = TestBed.get(ValueService);
|
||||
service = TestBed.inject(ValueService);
|
||||
expect(service.getValue()).toBe('real value');
|
||||
});
|
||||
// #enddocregion value-service-inject-it
|
||||
|
||||
it('can inject a default value when service is not provided', () => {
|
||||
// #docregion testbed-get-w-null
|
||||
service = TestBed.get(NotProvided, null); // service is null
|
||||
service = TestBed.inject(NotProvided, null); // service is null
|
||||
// #enddocregion testbed-get-w-null
|
||||
});
|
||||
|
||||
|
@ -109,8 +109,8 @@ describe('demo (with TestBed):', () => {
|
|||
]
|
||||
});
|
||||
// Inject both the service-to-test and its (spy) dependency
|
||||
masterService = TestBed.get(MasterService);
|
||||
valueServiceSpy = TestBed.get(ValueService);
|
||||
masterService = TestBed.inject(MasterService);
|
||||
valueServiceSpy = TestBed.inject(ValueService);
|
||||
});
|
||||
// #enddocregion master-service-before-each
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ describe('HeroesService (with mocks)', () => {
|
|||
|
||||
// Inject the http, test controller, and service-under-test
|
||||
// as they will be referenced by each test.
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
httpTestingController = TestBed.get(HttpTestingController);
|
||||
heroService = TestBed.get(HeroService);
|
||||
httpClient = TestBed.inject(HttpClient);
|
||||
httpTestingController = TestBed.inject(HttpTestingController);
|
||||
heroService = TestBed.inject(HeroService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -80,7 +80,7 @@ describe('HeroesService (with mocks)', () => {
|
|||
let expectedHeroes: Hero[];
|
||||
|
||||
beforeEach(() => {
|
||||
heroService = TestBed.get(HeroService);
|
||||
heroService = TestBed.inject(HeroService);
|
||||
expectedHeroes = [
|
||||
{ id: 1, name: 'A' },
|
||||
{ id: 2, name: 'B' },
|
||||
|
|
|
@ -27,8 +27,8 @@ describe('HttpClient testing', () => {
|
|||
});
|
||||
|
||||
// Inject the http service and test controller for each test
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
httpTestingController = TestBed.get(HttpTestingController);
|
||||
httpClient = TestBed.inject(HttpClient);
|
||||
httpTestingController = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
// #enddocregion setup
|
||||
// #docregion afterEach
|
||||
|
|
|
@ -25,8 +25,8 @@ describe('WelcomeComponent (class only)', () => {
|
|||
]
|
||||
});
|
||||
// inject both the component and the dependent service.
|
||||
comp = TestBed.get(WelcomeComponent);
|
||||
userService = TestBed.get(UserService);
|
||||
comp = TestBed.inject(WelcomeComponent);
|
||||
userService = TestBed.inject(UserService);
|
||||
});
|
||||
// #enddocregion class-only-before-each
|
||||
|
||||
|
@ -93,7 +93,7 @@ describe('WelcomeComponent', () => {
|
|||
// #docregion setup
|
||||
// #docregion inject-from-testbed
|
||||
// UserService from the root injector
|
||||
userService = TestBed.get(UserService);
|
||||
userService = TestBed.inject(UserService);
|
||||
// #enddocregion inject-from-testbed
|
||||
|
||||
// get the "welcome" element by CSS selector (e.g., by class name)
|
||||
|
|
|
@ -1031,7 +1031,7 @@ the setup of the _service-under-test_.
|
|||
|
||||
Now requests made in the course of your tests will hit the testing backend instead of the normal backend.
|
||||
|
||||
This setup also calls `TestBed.get()` to inject the `HttpClient` service and the mocking controller
|
||||
This setup also calls `TestBed.inject()` to inject the `HttpClient` service and the mocking controller
|
||||
so they can be referenced during the tests.
|
||||
|
||||
### Expecting and answering requests
|
||||
|
|
|
@ -355,7 +355,12 @@ array of the services that you'll test or mock.
|
|||
header="app/demo/demo.testbed.spec.ts (provide ValueService in beforeEach">
|
||||
</code-example>
|
||||
|
||||
Then inject it inside a test by calling `TestBed.get()` with the service class as the argument.
|
||||
Then inject it inside a test by calling `TestBed.inject()` with the service class as the argument.
|
||||
|
||||
**Note:** We used to have `TestBed.get()` instead of `TestBed.inject()`.
|
||||
The `get` method wasn't type safe, it always returned `any`, and this is error prone.
|
||||
We decided to migrate to a new function instead of updating the existing one given
|
||||
the large scale use that would have an immense amount of breaking changes.
|
||||
|
||||
<code-example
|
||||
path="testing/src/app/demo/demo.testbed.spec.ts"
|
||||
|
@ -1063,14 +1068,14 @@ The component injector is a property of the fixture's `DebugElement`.
|
|||
|
||||
{@a testbed-get}
|
||||
|
||||
#### _TestBed.get()_
|
||||
#### _TestBed.inject()_
|
||||
|
||||
You _may_ also be able to get the service from the root injector via `TestBed.get()`.
|
||||
You _may_ also be able to get the service from the root injector via `TestBed.inject()`.
|
||||
This is easier to remember and less verbose.
|
||||
But it only works when Angular injects the component with the service instance in the test's root injector.
|
||||
|
||||
In this test suite, the _only_ provider of `UserService` is the root testing module,
|
||||
so it is safe to call `TestBed.get()` as follows:
|
||||
so it is safe to call `TestBed.inject()` as follows:
|
||||
|
||||
<code-example
|
||||
path="testing/src/app/welcome/welcome.component.spec.ts"
|
||||
|
@ -1080,7 +1085,7 @@ so it is safe to call `TestBed.get()` as follows:
|
|||
|
||||
<div class="alert is-helpful">
|
||||
|
||||
For a use case in which `TestBed.get()` does not work,
|
||||
For a use case in which `TestBed.inject()` does not work,
|
||||
see the [_Override component providers_](#component-override) section that
|
||||
explains when and why you must get the service from the component's injector instead.
|
||||
|
||||
|
@ -1102,7 +1107,7 @@ a clone of the provided `userServiceStub`.
|
|||
|
||||
#### Final setup and tests
|
||||
|
||||
Here's the complete `beforeEach()`, using `TestBed.get()`:
|
||||
Here's the complete `beforeEach()`, using `TestBed.inject()`:
|
||||
|
||||
<code-example path="testing/src/app/welcome/welcome.component.spec.ts" region="setup" header="app/welcome/welcome.component.spec.ts"></code-example>
|
||||
|
||||
|
@ -3090,13 +3095,13 @@ Here are the most important static methods, in order of likely utility.
|
|||
|
||||
What if the service is optional?
|
||||
|
||||
The `TestBed.get()` method takes an optional second parameter,
|
||||
The `TestBed.inject()` method takes an optional second parameter,
|
||||
the object to return if Angular can't find the provider
|
||||
(`null` in this example):
|
||||
|
||||
<code-example path="testing/src/app/demo/demo.testbed.spec.ts" region="testbed-get-w-null" header="app/demo/demo.testbed.spec.ts"></code-example>
|
||||
|
||||
After calling `get`, the `TestBed` configuration is frozen for the duration of the current spec.
|
||||
After calling `TestBed.inject`, the `TestBed` configuration is frozen for the duration of the current spec.
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -84,17 +84,17 @@
|
|||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^8.1.0-next.1",
|
||||
"@angular/animations": "^9.0.0-next.5",
|
||||
"@angular/cdk": "8.0.0",
|
||||
"@angular/common": "^8.1.0-next.1",
|
||||
"@angular/core": "^8.1.0-next.1",
|
||||
"@angular/elements": "^8.1.0-next.1",
|
||||
"@angular/forms": "^8.1.0-next.1",
|
||||
"@angular/common": "^9.0.0-next.5",
|
||||
"@angular/core": "^9.0.0-next.5",
|
||||
"@angular/elements": "^9.0.0-next.5",
|
||||
"@angular/forms": "^9.0.0-next.5",
|
||||
"@angular/material": "8.0.0",
|
||||
"@angular/platform-browser": "^8.1.0-next.1",
|
||||
"@angular/platform-browser-dynamic": "^8.1.0-next.1",
|
||||
"@angular/router": "^8.1.0-next.1",
|
||||
"@angular/service-worker": "^8.1.0-next.1",
|
||||
"@angular/platform-browser": "^9.0.0-next.5",
|
||||
"@angular/platform-browser-dynamic": "^9.0.0-next.5",
|
||||
"@angular/router": "^9.0.0-next.5",
|
||||
"@angular/service-worker": "^9.0.0-next.5",
|
||||
"@types/lunr": "^2.3.2",
|
||||
"@webcomponents/custom-elements": "^1.2.0",
|
||||
"rxjs": "^6.5.2",
|
||||
|
@ -103,9 +103,9 @@
|
|||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "0.801.0-beta.2",
|
||||
"@angular/cli": "8.1.0-beta.2",
|
||||
"@angular/compiler": "^8.1.0-next.1",
|
||||
"@angular/compiler-cli": "^8.1.0-next.1",
|
||||
"@angular/language-service": "^8.1.0-next.1",
|
||||
"@angular/compiler": "^9.0.0-next.5",
|
||||
"@angular/compiler-cli": "^9.0.0-next.5",
|
||||
"@angular/language-service": "^9.0.0-next.5",
|
||||
"@types/jasmine": "^2.5.52",
|
||||
"@types/jasminewd2": "^2.0.4",
|
||||
"@types/node": "~6.0.60",
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"uncompressed": {
|
||||
"runtime-es5": 3042,
|
||||
"runtime-es2015": 3048,
|
||||
"main-es5": 511052,
|
||||
"main-es2015": 450562,
|
||||
"main-es5": 493318,
|
||||
"main-es2015": 434710,
|
||||
"polyfills-es5": 131024,
|
||||
"polyfills-es2015": 52433
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ describe('AppComponent', () => {
|
|||
});
|
||||
|
||||
it('should update the document title', async () => {
|
||||
const titleService = TestBed.get(Title);
|
||||
const titleService = TestBed.inject(Title);
|
||||
spyOn(titleService, 'setTitle');
|
||||
|
||||
await navigateTo('guide/pipes');
|
||||
|
@ -450,7 +450,7 @@ describe('AppComponent', () => {
|
|||
});
|
||||
|
||||
it('should update the document title, with a default value if the document has no title', async () => {
|
||||
const titleService = TestBed.get(Title);
|
||||
const titleService = TestBed.inject(Title);
|
||||
spyOn(titleService, 'setTitle');
|
||||
|
||||
await navigateTo('no-title');
|
||||
|
@ -782,14 +782,14 @@ describe('AppComponent', () => {
|
|||
|
||||
describe('showing search results', () => {
|
||||
it('should not display search results when query is empty', () => {
|
||||
const searchService: MockSearchService = TestBed.get(SearchService);
|
||||
const searchService = TestBed.inject(SearchService) as Partial<SearchService> as MockSearchService;
|
||||
searchService.searchResults.next({ query: '', results: [] });
|
||||
fixture.detectChanges();
|
||||
expect(component.showSearchResults).toBe(false);
|
||||
});
|
||||
|
||||
it('should hide the results when a search result is selected', () => {
|
||||
const searchService: MockSearchService = TestBed.get(SearchService);
|
||||
const searchService = TestBed.inject(SearchService) as Partial<SearchService> as MockSearchService;
|
||||
|
||||
const results = [
|
||||
{ path: 'news', title: 'News', type: 'marketing', keywords: '', titleWords: '', deprecated: false }
|
||||
|
@ -826,14 +826,14 @@ describe('AppComponent', () => {
|
|||
const description =
|
||||
`should ${doRedirect ? '' : 'not '}redirect to 'docs' if deployment mode is '${mode}' ` +
|
||||
'and at a marketing page';
|
||||
const verifyNoRedirection = () => expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
const verifyRedirection = () => expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs');
|
||||
const verifyNoRedirection = () => expect(TestBed.inject(LocationService).replace).not.toHaveBeenCalled();
|
||||
const verifyRedirection = () => expect(TestBed.inject(LocationService).replace).toHaveBeenCalledWith('docs');
|
||||
const verifyPossibleRedirection = doRedirect ? verifyRedirection : verifyNoRedirection;
|
||||
|
||||
it(description, () => {
|
||||
createTestingModule('', mode);
|
||||
|
||||
const navService = TestBed.get(NavigationService) as NavigationService;
|
||||
const navService = TestBed.inject(NavigationService);
|
||||
const testCurrentNodes = navService.currentNodes = new Subject<CurrentNodes>();
|
||||
|
||||
initializeTest(false);
|
||||
|
|
|
@ -222,7 +222,7 @@ describe('CodeComponent', () => {
|
|||
});
|
||||
|
||||
it('should call copier service when clicked', () => {
|
||||
const copierService: CopierService = TestBed.get(CopierService);
|
||||
const copierService: CopierService = TestBed.inject(CopierService);
|
||||
const spy = spyOn(copierService, 'copyText');
|
||||
expect(spy.calls.count()).toBe(0, 'before click');
|
||||
getButton().click();
|
||||
|
@ -230,14 +230,14 @@ describe('CodeComponent', () => {
|
|||
});
|
||||
|
||||
it('should copy code text when clicked', () => {
|
||||
const copierService: CopierService = TestBed.get(CopierService);
|
||||
const copierService: CopierService = TestBed.inject(CopierService);
|
||||
const spy = spyOn(copierService, 'copyText');
|
||||
getButton().click();
|
||||
expect(spy.calls.argsFor(0)[0]).toBe(oneLineCode, 'after click');
|
||||
});
|
||||
|
||||
it('should preserve newlines in the copied code', () => {
|
||||
const copierService: CopierService = TestBed.get(CopierService);
|
||||
const copierService: CopierService = TestBed.inject(CopierService);
|
||||
const spy = spyOn(copierService, 'copyText');
|
||||
const expectedCode = smallMultiLineCode.trim().replace(/</g, '<').replace(/>/g, '>');
|
||||
let actualCode;
|
||||
|
@ -258,8 +258,8 @@ describe('CodeComponent', () => {
|
|||
});
|
||||
|
||||
it('should display a message when copy succeeds', () => {
|
||||
const snackBar: MatSnackBar = TestBed.get(MatSnackBar);
|
||||
const copierService: CopierService = TestBed.get(CopierService);
|
||||
const snackBar: MatSnackBar = TestBed.inject(MatSnackBar);
|
||||
const copierService: CopierService = TestBed.inject(CopierService);
|
||||
spyOn(snackBar, 'open');
|
||||
spyOn(copierService, 'copyText').and.returnValue(true);
|
||||
getButton().click();
|
||||
|
@ -267,9 +267,9 @@ describe('CodeComponent', () => {
|
|||
});
|
||||
|
||||
it('should display an error when copy fails', () => {
|
||||
const snackBar: MatSnackBar = TestBed.get(MatSnackBar);
|
||||
const copierService: CopierService = TestBed.get(CopierService);
|
||||
const logger: TestLogger = TestBed.get(Logger);
|
||||
const snackBar: MatSnackBar = TestBed.inject(MatSnackBar);
|
||||
const copierService: CopierService = TestBed.inject(CopierService);
|
||||
const logger = TestBed.inject(Logger) as unknown as TestLogger;
|
||||
spyOn(snackBar, 'open');
|
||||
spyOn(copierService, 'copyText').and.returnValue(false);
|
||||
getButton().click();
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('FileNotFoundSearchComponent', () => {
|
|||
});
|
||||
|
||||
fixture = TestBed.createComponent(FileNotFoundSearchComponent);
|
||||
searchService = TestBed.get(SearchService);
|
||||
searchService = TestBed.inject(SearchService);
|
||||
searchResultSubject = new Subject<SearchResults>();
|
||||
spyOn(searchService, 'search').and.callFake(() => searchResultSubject.asObservable());
|
||||
fixture.detectChanges();
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('TocComponent', () => {
|
|||
fixture = TestBed.createComponent(HostEmbeddedTocComponent);
|
||||
tocComponentDe = fixture.debugElement.children[0];
|
||||
tocComponent = tocComponentDe.componentInstance;
|
||||
tocService = TestBed.get(TocService);
|
||||
tocService = TestBed.inject(TocService) as unknown as TestTocService;
|
||||
});
|
||||
|
||||
it('should create tocComponent', () => {
|
||||
|
@ -137,7 +137,7 @@ describe('TocComponent', () => {
|
|||
beforeEach(() => {
|
||||
fixture.detectChanges();
|
||||
page = setPage();
|
||||
scrollToTopSpy = TestBed.get(ScrollService).scrollToTop;
|
||||
scrollToTopSpy = (TestBed.inject(ScrollService) as unknown as TestScrollService).scrollToTop;
|
||||
});
|
||||
|
||||
it('should have more than 4 displayed items', () => {
|
||||
|
@ -252,7 +252,7 @@ describe('TocComponent', () => {
|
|||
|
||||
tocComponentDe = fixture.debugElement.children[0];
|
||||
tocComponent = tocComponentDe.componentInstance;
|
||||
tocService = TestBed.get(TocService);
|
||||
tocService = TestBed.inject(TocService) as unknown as TestTocService;
|
||||
|
||||
fixture.detectChanges();
|
||||
page = setPage();
|
||||
|
|
|
@ -128,8 +128,8 @@ describe('DocViewerComponent', () => {
|
|||
};
|
||||
|
||||
beforeEach(() => {
|
||||
titleService = TestBed.get(Title);
|
||||
tocService = TestBed.get(TocService);
|
||||
titleService = TestBed.inject(Title) as unknown as MockTitle;
|
||||
tocService = TestBed.inject(TocService) as unknown as MockTocService;
|
||||
|
||||
targetEl = document.createElement('div');
|
||||
document.body.appendChild(targetEl); // Required for `innerText` to work as expected.
|
||||
|
@ -299,7 +299,7 @@ describe('DocViewerComponent', () => {
|
|||
docViewer.render({contents, id}).toPromise();
|
||||
|
||||
beforeEach(() => {
|
||||
const elementsLoader = TestBed.get(ElementsLoader) as MockElementsLoader;
|
||||
const elementsLoader = TestBed.inject(ElementsLoader) as Partial<ElementsLoader> as MockElementsLoader;
|
||||
loadElementsSpy = elementsLoader.loadContainedCustomElements.and.returnValue(of(undefined));
|
||||
prepareTitleAndTocSpy = spyOn(docViewer, 'prepareTitleAndToc');
|
||||
swapViewsSpy = spyOn(docViewer, 'swapViews').and.returnValue(of(undefined));
|
||||
|
@ -369,17 +369,17 @@ describe('DocViewerComponent', () => {
|
|||
|
||||
it('should remove the "noindex" meta tag if the document is valid', async () => {
|
||||
await doRender('foo', 'bar');
|
||||
expect(TestBed.get(Meta).removeTag).toHaveBeenCalledWith('name="robots"');
|
||||
expect(TestBed.inject(Meta).removeTag).toHaveBeenCalledWith('name="robots"');
|
||||
});
|
||||
|
||||
it('should add the "noindex" meta tag if the document is 404', async () => {
|
||||
await doRender('missing', FILE_NOT_FOUND_ID);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
|
||||
it('should add a "noindex" meta tag if the document fetching fails', async () => {
|
||||
await doRender('error', FETCHING_ERROR_ID);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -454,7 +454,9 @@ describe('DocViewerComponent', () => {
|
|||
describe('(on error) should clean up, log the error and recover', () => {
|
||||
let logger: MockLogger;
|
||||
|
||||
beforeEach(() => logger = TestBed.get(Logger));
|
||||
beforeEach(() => {
|
||||
logger = TestBed.inject(Logger) as unknown as MockLogger;
|
||||
});
|
||||
|
||||
it('when `prepareTitleAndTocSpy()` fails', async () => {
|
||||
const error = Error('Typical `prepareTitleAndToc()` error');
|
||||
|
@ -472,7 +474,7 @@ describe('DocViewerComponent', () => {
|
|||
[jasmine.any(Error)]
|
||||
]);
|
||||
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'foo': ${error.stack}`);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
|
||||
it('when `EmbedComponentsService.embedInto()` fails', async () => {
|
||||
|
@ -491,7 +493,7 @@ describe('DocViewerComponent', () => {
|
|||
expect(logger.output.error).toEqual([
|
||||
[jasmine.any(Error)]
|
||||
]);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
|
||||
it('when `swapViews()` fails', async () => {
|
||||
|
@ -510,7 +512,7 @@ describe('DocViewerComponent', () => {
|
|||
[jasmine.any(Error)]
|
||||
]);
|
||||
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'qux': ${error.stack}`);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
|
||||
it('when something fails with non-Error', async () => {
|
||||
|
@ -528,7 +530,7 @@ describe('DocViewerComponent', () => {
|
|||
[jasmine.any(Error)]
|
||||
]);
|
||||
expect(logger.output.error[0][0].message).toEqual(`[DocViewer] Error preparing document 'qux': ${error}`);
|
||||
expect(TestBed.get(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
expect(TestBed.inject(Meta).addTag).toHaveBeenCalledWith({ name: 'robots', content: 'noindex' });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ describe('NotificationComponent', () => {
|
|||
it('should update localStorage key when dismiss is called', () => {
|
||||
configTestingModule();
|
||||
createComponent();
|
||||
const setItemSpy: jasmine.Spy = TestBed.get(WindowToken).localStorage.setItem;
|
||||
const setItemSpy: jasmine.Spy = (TestBed.inject(WindowToken) as MockWindow).localStorage.setItem;
|
||||
component.dismiss();
|
||||
expect(setItemSpy).toHaveBeenCalledWith('aio-notification/survey-january-2018', 'hide');
|
||||
});
|
||||
|
@ -105,7 +105,7 @@ describe('NotificationComponent', () => {
|
|||
|
||||
it('should not show the notification if the there is a "hide" flag in localStorage', () => {
|
||||
configTestingModule();
|
||||
const getItemSpy: jasmine.Spy = TestBed.get(WindowToken).localStorage.getItem;
|
||||
const getItemSpy: jasmine.Spy = (TestBed.inject(WindowToken) as MockWindow).localStorage.getItem;
|
||||
getItemSpy.and.returnValue('hide');
|
||||
createComponent();
|
||||
expect(getItemSpy).toHaveBeenCalledWith('aio-notification/survey-january-2018');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const WindowToken = new InjectionToken('Window');
|
||||
export const WindowToken = new InjectionToken<Window>('Window');
|
||||
export function windowProvider() { return window; }
|
||||
|
|
106
aio/yarn.lock
106
aio/yarn.lock
|
@ -103,10 +103,10 @@
|
|||
"@angular-devkit/core" "8.1.0-beta.2"
|
||||
rxjs "6.4.0"
|
||||
|
||||
"@angular/animations@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-8.1.0-next.1.tgz#6c79ac16b7da239b7823259994d2b379d883dd68"
|
||||
integrity sha512-drwdK7ARU41hGj6JebO7gF0MeeNz3qSMoPs8zRqjC3sfWZ4Jp9eNlfTf1b86gd6w9GMeOna/JjwxUeNEmxdLBw==
|
||||
"@angular/animations@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-9.0.0-next.5.tgz#8cce8daa3691ce27748e8b6af1a617362dc5b7e7"
|
||||
integrity sha512-2MgAbHDX7bxdF+2xgav/2c3hWfWhVWsh5Ts5GYXjDjCPC/WAGy6Knw+t8MaUzh7Mym0JXB6kENZM7Ux+a3vzJw==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
|
@ -142,17 +142,17 @@
|
|||
universal-analytics "^0.4.20"
|
||||
uuid "^3.3.2"
|
||||
|
||||
"@angular/common@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/common/-/common-8.1.0-next.1.tgz#2b6674ad46c13d0e24fedb6f239d338448ca72b0"
|
||||
integrity sha512-sHzv1QIt2g6stXVqIiHpR2yk8goA3nek1FohUWz4H9mE24Knb4qSNvn25wztYdH5n5WPY+jyHyhWrqoXtrPvuQ==
|
||||
"@angular/common@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/common/-/common-9.0.0-next.5.tgz#3e9929135734ba821ba87ea5395f4d07d6876348"
|
||||
integrity sha512-f7JCYxTYxXEXuq+2qOgThU/C243Jt2SsB1z3xseYyocoFqB70S3Wd7HpCdeP9XzgfeMAXVkUZO/lYzZCedhN3g==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/compiler-cli@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-8.1.0-next.1.tgz#27047724d40a40b172497a0ebc40846a16bc481b"
|
||||
integrity sha512-pJ5s5cEh/cXasMwUzJLwypoSaDzmAV6tfOKhm3bN6dfSh1bS8jliElIwxgPkqlUv9zo4Io/RZD4KgvwBzD7WSw==
|
||||
"@angular/compiler-cli@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-9.0.0-next.5.tgz#9c7bcdfe08fa078ac0df092dd3724e97b49ca985"
|
||||
integrity sha512-2FIvp6bIV/gBi5o17MARNoMYcljLjbkh5Az238O3KSaO9BB5wRt/eq749R/ZepizBlyYtXhCFLmLh84bsBZzPQ==
|
||||
dependencies:
|
||||
canonical-path "1.0.0"
|
||||
chokidar "^2.1.1"
|
||||
|
@ -161,43 +161,42 @@
|
|||
magic-string "^0.25.0"
|
||||
minimist "^1.2.0"
|
||||
reflect-metadata "^0.1.2"
|
||||
shelljs "^0.8.1"
|
||||
source-map "^0.6.1"
|
||||
tslib "^1.9.0"
|
||||
yargs "13.1.0"
|
||||
|
||||
"@angular/compiler@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-8.1.0-next.1.tgz#e0dadb973b15497d9afccccd1e56ae36c3a32014"
|
||||
integrity sha512-3Qh4cSEPX3C2c+J9xea0CNnoy/UqtCqHzVuslfCdTRrgdCYx2xxcHvmwZHccDyTCTW8bX7C4jjr0Gf1w1lANlg==
|
||||
"@angular/compiler@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0-next.5.tgz#0cb658641a3347e5d311d5816cc7f444205de64d"
|
||||
integrity sha512-l22sdTaJqhZQ6VFTU8TgjvlYyT1xTcvtVhCV6cKypJRk1HnIyNxkm1Lh2LR6NJe3/a4fvB7kDxbpFuOVoUYxJg==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/core@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/core/-/core-8.1.0-next.1.tgz#ff8c51089a46e5fdaaa77bb65efb1b07aee47d68"
|
||||
integrity sha512-i26/UkfTOd+nZuPbUOgGHGSWwl1fghUlLwQHvDqtdMC2VANQOjEyQZrcNHP+N7ZumVdcfxDAisFOMWgnwFzVcw==
|
||||
"@angular/core@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0-next.5.tgz#3444ee6ebc552c2c72dad1ac03a0d5eb03cb4607"
|
||||
integrity sha512-UmIoohI8ywOq7YEdwIMERaGwsyRtX6dJ9HjnPK6Qs05rlUaHTmKZOOoX3W2lmdAzxAqrKMeAXIDGT7v3vjWVuA==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/elements@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/elements/-/elements-8.1.0-next.1.tgz#dbe64cc671bf94cafbad4225905f287cdb37ea01"
|
||||
integrity sha512-exxENgFIgUlKJcCrj0LyiAYPUhu5wNk5XfRCVXxoNIGXgsMtrKGXX5HYrZyRtKJhCwyvkuLg7IjdBzD9KoThrw==
|
||||
"@angular/elements@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/elements/-/elements-9.0.0-next.5.tgz#f37f4ca09d37a2d50826ddd36b010f033c328f9e"
|
||||
integrity sha512-FkShpGYoMOIrEh24+trDaUkh+gNQG4G6FVIG7RVblLAIuYPfX/ocrelQrDyacmQP6nZk6v4sEQEnmP3lnqceHw==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/forms@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-8.1.0-next.1.tgz#5cfee3f7e9ad8add06fe25419b06c8a7f8b9f72d"
|
||||
integrity sha512-NRiiV06FoMXU99eKv8poKEp1+VQntZnD8ADv4Z9YcU6XhngO09c0K/jmHABGh6oym+GtF2gRocTZ65a2FeUeDw==
|
||||
"@angular/forms@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-9.0.0-next.5.tgz#fe3bb1cd517e4d9d22b452219e4989bfd1a6de0a"
|
||||
integrity sha512-KMd4DqflszrGa3kwjIi8mSkJVVTh0G3M99J33bhw4sbziUJ1Bc8is3SCn1u2J4GLWe1Tm8Oi6sEUGcVljv2VKA==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/language-service@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-8.1.0-next.1.tgz#35b72dd320b46abe631f209759e5c939d8b2b725"
|
||||
integrity sha512-LlpStVhf4GEazD6/6i8DftNndEkrBoTxd6Bi5kFHrDmJB+cT5evVZHomXJcwHjZx31gpcLAot6lr7WCRkmbD0g==
|
||||
"@angular/language-service@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-9.0.0-next.5.tgz#bb8c991601f1a5c590fe9fdd64120555420008f8"
|
||||
integrity sha512-6GgqhzsRTRAgQS1jt2BpYq3EOjfJTCo/eZJzg0BuxZRs6Vm1u4ytp4fQbNEMwT5zEMNoPgF8hfkJKKT+m2XW5w==
|
||||
|
||||
"@angular/material@8.0.0":
|
||||
version "8.0.0"
|
||||
|
@ -206,31 +205,31 @@
|
|||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
|
||||
"@angular/platform-browser-dynamic@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.1.0-next.1.tgz#6e927d97583ec2bb9a9803c0f5003ef41fc39d9e"
|
||||
integrity sha512-BDeLlzpg7T2nv3Y6ywQAW+cBAgbSQUku7W1p71vFGqE8p4c79HmKbykGSR1/n7Sez8LV+N1LpliCrNQEgGtBaA==
|
||||
"@angular/platform-browser-dynamic@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.0.0-next.5.tgz#694056484a7c81b010c7cf8c8892bd2a90815863"
|
||||
integrity sha512-8SzMv2sIDfcRKEK4YkymNzd0mGFYtFIGKiduHvTmFUu2UCWV/gzGJxvr5YoiP/rs65RLbyfGmfaVzCxT24iolw==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/platform-browser@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-8.1.0-next.1.tgz#0cf2b04437d190687d7efbaa6b7e9be5f5a076e2"
|
||||
integrity sha512-EkDgr1wWW2eAd542k46JKb9jIr50M5eiq49QjDVmnjXCS1WNIyiW1TxTpyOiDNz8nK0jHYTzEw+PWEyvmwJV8Q==
|
||||
"@angular/platform-browser@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-9.0.0-next.5.tgz#61158b4aa3e00e701af77dc3d40fdaf2f38be1ac"
|
||||
integrity sha512-meGVirDpVDXVNaFjOHalMT5i/3CJR+0JyFvbhDYpgGTBKMS3pLACmexOKJaS6jH1kS/3fch584iqS5x3WFzkzg==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/router@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/router/-/router-8.1.0-next.1.tgz#b957531748e153ddafb666fd8cd68546a7508e54"
|
||||
integrity sha512-balgDD3IlsnWs+WWuSAQn3oXULbh44oklqBQgDAl8CX94ki0jDCeVFob57cCflqRx7WjtxB053X9keg6EA2YtA==
|
||||
"@angular/router@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/router/-/router-9.0.0-next.5.tgz#bca260142e2f16f2f8a024efc1e818729df5e899"
|
||||
integrity sha512-EpfwZWv5x6lG6BAjyoXs7gAfgghbWcPOrLTsEfcTIfyU8AHIgEqu1h5O2qfqQjmUNhhOXp3hxV98xF5ap5YyZQ==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/service-worker@^8.1.0-next.1":
|
||||
version "8.1.0-next.1"
|
||||
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-8.1.0-next.1.tgz#bf00349b1993a6ecda07b9c08920b16aae176950"
|
||||
integrity sha512-lctU2Dq96ovsFU/e7vIKUUvg+k5H2w+RHOx8ARlgraCU3T5fYyriQvZ9GH7y86fkAFtSrQ6MX0+pnY5dFUUZ1Q==
|
||||
"@angular/service-worker@^9.0.0-next.5":
|
||||
version "9.0.0-next.5"
|
||||
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-9.0.0-next.5.tgz#7f287024692a8502c73074515c24e583f697722a"
|
||||
integrity sha512-DzCf2wDpmGpmOHru8D1QqV5iTT1tCTZ/fj/24etOC10lPtSWl87wfY8YcAzQZ+MFa6pvk67U/5KC/VtmzYgd/g==
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
|
@ -9507,15 +9506,6 @@ shelljs@^0.7.0, shelljs@^0.7.5, shelljs@^0.7.7:
|
|||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
shelljs@^0.8.1:
|
||||
version "0.8.3"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097"
|
||||
integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
||||
|
|
|
@ -1318,7 +1318,7 @@ export class TransitionAnimationEngine {
|
|||
const previousPlayers = this._getPreviousPlayers(
|
||||
element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState);
|
||||
previousPlayers.forEach(player => {
|
||||
const realPlayer = player.getRealPlayer() as any;
|
||||
const realPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as any;
|
||||
if (realPlayer.beforeDestroy) {
|
||||
realPlayer.beforeDestroy();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {buildAnimationAst} from '../../src/dsl/animation_ast_builder';
|
|||
import {buildTrigger} from '../../src/dsl/animation_trigger';
|
||||
import {AnimationStyleNormalizer, NoopAnimationStyleNormalizer} from '../../src/dsl/style_normalization/animation_style_normalizer';
|
||||
import {getBodyNode} from '../../src/render/shared';
|
||||
import {TransitionAnimationEngine} from '../../src/render/transition_animation_engine';
|
||||
import {TransitionAnimationEngine, TransitionAnimationPlayer} from '../../src/render/transition_animation_engine';
|
||||
import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_animation_driver';
|
||||
|
||||
const DEFAULT_NAMESPACE_ID = 'id';
|
||||
|
@ -127,7 +127,9 @@ const DEFAULT_NAMESPACE_ID = 'id';
|
|||
registerTrigger(element, engine, trig);
|
||||
setProperty(element, engine, 'myTrigger', 'value');
|
||||
engine.flush();
|
||||
expect((engine.players[0].getRealPlayer() as MockAnimationPlayer).duration)
|
||||
expect(((engine.players[0] as TransitionAnimationPlayer)
|
||||
.getRealPlayer() as MockAnimationPlayer)
|
||||
.duration)
|
||||
.toEqual(1234);
|
||||
|
||||
engine.destroy(DEFAULT_NAMESPACE_ID, null);
|
||||
|
@ -135,7 +137,9 @@ const DEFAULT_NAMESPACE_ID = 'id';
|
|||
registerTrigger(element, engine, trig);
|
||||
setProperty(element, engine, 'myTrigger', 'value2');
|
||||
engine.flush();
|
||||
expect((engine.players[0].getRealPlayer() as MockAnimationPlayer).duration)
|
||||
expect(((engine.players[0] as TransitionAnimationPlayer)
|
||||
.getRealPlayer() as MockAnimationPlayer)
|
||||
.duration)
|
||||
.toEqual(1234);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -145,7 +145,7 @@ describe('insert/remove', () => {
|
|||
}));
|
||||
|
||||
it('should resolve components from other modules, if supplied', async(() => {
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
let fixture = TestBed.createComponent(TestComponent);
|
||||
|
||||
fixture.detectChanges();
|
||||
|
@ -160,7 +160,7 @@ describe('insert/remove', () => {
|
|||
|
||||
it('should clean up moduleRef, if supplied', async(() => {
|
||||
let destroyed = false;
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
|
||||
fixture.componentInstance.currentComponent = Module2InjectedComponent;
|
||||
|
@ -175,7 +175,7 @@ describe('insert/remove', () => {
|
|||
}));
|
||||
|
||||
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const fixture = TestBed.createComponent(TestComponent);
|
||||
|
||||
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
|
||||
|
@ -192,7 +192,7 @@ describe('insert/remove', () => {
|
|||
}));
|
||||
|
||||
it('should re-create moduleRef when changed', async(() => {
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
|
||||
fixture.componentInstance.currentComponent = Module2InjectedComponent;
|
||||
|
|
|
@ -75,7 +75,7 @@ describe('LocationProvider', () => {
|
|||
providers: [UpgradeModule],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
});
|
||||
|
||||
|
@ -101,7 +101,7 @@ describe('LocationHtml5Url', function() {
|
|||
providers: [UpgradeModule],
|
||||
|
||||
});
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
});
|
||||
|
||||
|
@ -176,7 +176,7 @@ describe('NewUrl', function() {
|
|||
providers: [UpgradeModule],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
});
|
||||
|
||||
|
@ -482,7 +482,7 @@ describe('New URL Parsing', () => {
|
|||
providers: [UpgradeModule],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
});
|
||||
|
||||
|
@ -512,7 +512,7 @@ describe('New URL Parsing', () => {
|
|||
providers: [UpgradeModule],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
});
|
||||
|
||||
|
@ -639,7 +639,7 @@ describe('$location.onChange()', () => {
|
|||
providers: [UpgradeModule],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {get: injectorFactory()};
|
||||
mock$rootScope = upgradeModule.$injector.get('$rootScope');
|
||||
});
|
||||
|
|
|
@ -100,7 +100,7 @@ describe('ngInjectableDef Bazel Integration', () => {
|
|||
TestBed.configureTestingModule({});
|
||||
TestBed.overrideProvider(Service, {useValue: new Service('overridden')});
|
||||
|
||||
expect(TestBed.get(Service).value).toEqual('overridden');
|
||||
expect(TestBed.inject(Service).value).toEqual('overridden');
|
||||
});
|
||||
|
||||
it('allows provider override in JIT for module-scoped @Injectables', () => {
|
||||
|
@ -122,7 +122,7 @@ describe('ngInjectableDef Bazel Integration', () => {
|
|||
});
|
||||
TestBed.overrideProvider(Service, {useValue: new Service('overridden')});
|
||||
|
||||
expect(TestBed.get(Service).value).toEqual('overridden');
|
||||
expect(TestBed.inject(Service).value).toEqual('overridden');
|
||||
});
|
||||
|
||||
it('does not override existing ngInjectableDef', () => {
|
||||
|
@ -140,7 +140,7 @@ describe('ngInjectableDef Bazel Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({});
|
||||
expect(TestBed.get(Service).value).toEqual(true);
|
||||
expect(TestBed.inject(Service).value).toEqual(true);
|
||||
});
|
||||
|
||||
it('does not override existing ngInjectableDef in case of inheritance', () => {
|
||||
|
@ -157,14 +157,14 @@ describe('ngInjectableDef Bazel Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({});
|
||||
// We are asserting that system throws an error, rather than taking the inherited annotation.
|
||||
expect(() => TestBed.get(ChildService).value).toThrowError(/ChildService/);
|
||||
expect(() => TestBed.inject(ChildService).value).toThrowError(/ChildService/);
|
||||
});
|
||||
|
||||
it('NgModule injector understands requests for INJECTABLE', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [{provide: 'foo', useValue: 'bar'}],
|
||||
});
|
||||
expect(TestBed.get(INJECTOR).get('foo')).toEqual('bar');
|
||||
expect(TestBed.inject(INJECTOR).get('foo')).toEqual('bar');
|
||||
});
|
||||
|
||||
it('Component injector understands requests for INJECTABLE', () => {
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('Jit Summaries', () => {
|
|||
TestBed.configureTestingModule({
|
||||
providers: [SomeService, SomeDep],
|
||||
});
|
||||
TestBed.get(SomeService);
|
||||
TestBed.inject(SomeService);
|
||||
expectInstanceCreated(SomeService);
|
||||
});
|
||||
|
||||
|
@ -70,4 +70,4 @@ describe('Jit Summaries', () => {
|
|||
.createComponent(SomePrivateComponent);
|
||||
expectInstanceCreated(SomePrivateComponent);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -187,7 +187,7 @@ describe('attribute binding', () => {
|
|||
// NOTE: different browsers will add `//` into the URI.
|
||||
expect(a.href.indexOf('unsafe:')).toBe(0);
|
||||
|
||||
const domSanitizer: DomSanitizer = TestBed.get(DomSanitizer);
|
||||
const domSanitizer: DomSanitizer = TestBed.inject(DomSanitizer);
|
||||
fixture.componentInstance.badUrl =
|
||||
domSanitizer.bypassSecurityTrustUrl('javascript:alert("this is fine")');
|
||||
fixture.detectChanges();
|
||||
|
|
|
@ -54,7 +54,7 @@ describe('di', () => {
|
|||
]
|
||||
});
|
||||
|
||||
expect(TestBed.get(testToken) as string[]).toEqual(['A', 'B', 'C']);
|
||||
expect(TestBed.inject(testToken)).toEqual(['A', 'B', 'C']);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ describe('property bindings', () => {
|
|||
|
||||
expect(a.href.indexOf('unsafe:')).toBe(0);
|
||||
|
||||
const domSanitzer: DomSanitizer = TestBed.get(DomSanitizer);
|
||||
const domSanitzer: DomSanitizer = TestBed.inject(DomSanitizer);
|
||||
fixture.componentInstance.url =
|
||||
domSanitzer.bypassSecurityTrustUrl('javascript:alert("the developer wanted this");');
|
||||
fixture.detectChanges();
|
||||
|
@ -353,7 +353,7 @@ describe('property bindings', () => {
|
|||
template: `
|
||||
<button idDir [id]="id1">Click me</button>
|
||||
<button *ngIf="condition" [id]="id2">Click me too (2)</button>
|
||||
<button *ngIf="!condition" otherDir [id]="id3">Click me too (3)</button>
|
||||
<button *ngIf="!condition" otherDir [id]="id3">Click me too (3)</button>
|
||||
`
|
||||
})
|
||||
class App {
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('router integration acceptance', () => {
|
|||
TestBed.configureTestingModule({
|
||||
imports: [RootModule],
|
||||
});
|
||||
expect((TestBed.get(Router) as Router).config.map(r => r.path)).toEqual([
|
||||
expect((TestBed.inject(Router)).config.map(r => r.path)).toEqual([
|
||||
'1a:1',
|
||||
'1a:2',
|
||||
'1b:1',
|
||||
|
|
|
@ -728,7 +728,7 @@ describe('new styling integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const sanitizer: DomSanitizer = TestBed.get(DomSanitizer);
|
||||
const sanitizer: DomSanitizer = TestBed.inject(DomSanitizer);
|
||||
|
||||
fixture.componentInstance.path = sanitizer.bypassSecurityTrustStyle('url("#test")');
|
||||
fixture.detectChanges();
|
||||
|
|
|
@ -144,7 +144,7 @@ describe('styling', () => {
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const sanitizer: DomSanitizer = TestBed.get(DomSanitizer);
|
||||
const sanitizer: DomSanitizer = TestBed.inject(DomSanitizer);
|
||||
|
||||
fixture.componentInstance.image = sanitizer.bypassSecurityTrustStyle('url("#test")');
|
||||
fixture.detectChanges();
|
||||
|
@ -187,7 +187,7 @@ describe('styling', () => {
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const sanitizer: DomSanitizer = TestBed.get(DomSanitizer);
|
||||
const sanitizer: DomSanitizer = TestBed.inject(DomSanitizer);
|
||||
|
||||
fixture.componentInstance.path = sanitizer.bypassSecurityTrustStyle('url("#test")');
|
||||
fixture.detectChanges();
|
||||
|
|
|
@ -590,7 +590,7 @@ describe('ViewContainerRef', () => {
|
|||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({declarations: [EmbeddedViewInsertionComp, VCRefDirective]});
|
||||
|
||||
const _origRendererFactory = TestBed.get(RendererFactory2) as RendererFactory2;
|
||||
const _origRendererFactory = TestBed.inject(RendererFactory2);
|
||||
const _origCreateRenderer = _origRendererFactory.createRenderer;
|
||||
|
||||
_origRendererFactory.createRenderer = function(element: any, type: RendererType2|null) {
|
||||
|
@ -944,9 +944,9 @@ describe('ViewContainerRef', () => {
|
|||
{provide: String, useValue: 'root_module'},
|
||||
// We need to provide the following tokens because otherwise view engine
|
||||
// will throw when creating a component factory in debug mode.
|
||||
{provide: Sanitizer, useValue: TestBed.get(DomSanitizer)},
|
||||
{provide: ErrorHandler, useValue: TestBed.get(ErrorHandler)},
|
||||
{provide: RendererFactory2, useValue: TestBed.get(RendererFactory2)},
|
||||
{provide: Sanitizer, useValue: TestBed.inject(DomSanitizer)},
|
||||
{provide: ErrorHandler, useValue: TestBed.inject(ErrorHandler)},
|
||||
{provide: RendererFactory2, useValue: TestBed.inject(RendererFactory2)},
|
||||
]
|
||||
})
|
||||
class MyAppModule {
|
||||
|
@ -958,7 +958,7 @@ describe('ViewContainerRef', () => {
|
|||
|
||||
// Compile test modules in order to be able to pass the NgModuleRef or the
|
||||
// module injector to the ViewContainerRef create component method.
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const appModuleFactory = compiler.compileModuleSync(MyAppModule);
|
||||
const someModuleFactory = compiler.compileModuleSync(SomeModule);
|
||||
const appModuleRef = appModuleFactory.create(null);
|
||||
|
|
|
@ -203,7 +203,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -243,7 +243,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
declarations: [Cmp]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -275,7 +275,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'on';
|
||||
|
@ -315,7 +315,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = true;
|
||||
|
@ -437,7 +437,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 0;
|
||||
|
@ -482,7 +482,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -554,7 +554,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -591,7 +591,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -683,7 +683,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -735,7 +735,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -780,7 +780,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -835,7 +835,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -878,7 +878,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -928,7 +928,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -984,7 +984,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -1038,7 +1038,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -1082,7 +1082,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
const element = fixture.nativeElement;
|
||||
|
@ -1135,7 +1135,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1280,7 +1280,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = true;
|
||||
|
@ -1370,7 +1370,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = true;
|
||||
|
@ -1404,7 +1404,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1438,13 +1438,13 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
engine.flush();
|
||||
|
||||
const player = engine.players.pop();
|
||||
const player = engine.players.pop() !;
|
||||
player.finish();
|
||||
|
||||
expect(hasStyle(cmp.element.nativeElement, 'background-color', 'green')).toBeTruthy();
|
||||
|
@ -1581,7 +1581,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = true;
|
||||
|
@ -1639,7 +1639,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'go';
|
||||
|
@ -1681,7 +1681,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1774,7 +1774,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine) as ɵAnimationEngine;
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1830,7 +1830,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1889,7 +1889,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1940,7 +1940,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1982,7 +1982,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2027,7 +2027,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2077,7 +2077,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2131,7 +2131,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2199,7 +2199,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2274,7 +2274,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [OuterCmp, InnerCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(OuterCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -2463,7 +2463,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'true';
|
||||
|
@ -2499,7 +2499,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2509,7 +2509,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
expect(cmp.event).toBeFalsy();
|
||||
|
||||
const player = engine.players.pop();
|
||||
const player = engine.players.pop() !;
|
||||
player.finish();
|
||||
flushMicrotasks();
|
||||
|
||||
|
@ -2559,7 +2559,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2621,7 +2621,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2730,7 +2730,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'TRUE';
|
||||
|
@ -2875,7 +2875,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp1 = 'go';
|
||||
|
@ -2957,7 +2957,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'go';
|
||||
|
@ -3078,7 +3078,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
|
||||
function assertHeight(element: any, height: string) {
|
||||
expect(element.style['height']).toEqual(height);
|
||||
|
@ -3448,7 +3448,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.disableExp = true;
|
||||
|
@ -3607,7 +3607,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -3688,7 +3688,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
|
||||
const runCD = () => fixture.detectChanges();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import {AUTO_STYLE, AnimationPlayer, animate, animateChild, group, query, sequence, stagger, state, style, transition, trigger, ɵAnimationGroupPlayer as AnimationGroupPlayer} from '@angular/animations';
|
||||
import {AnimationDriver, ɵAnimationEngine} from '@angular/animations/browser';
|
||||
import {matchesElement} from '@angular/animations/browser/src/render/shared';
|
||||
import {TransitionAnimationPlayer} from '@angular/animations/browser/src/render/transition_animation_engine';
|
||||
import {ENTER_CLASSNAME, LEAVE_CLASSNAME} from '@angular/animations/browser/src/util';
|
||||
import {MockAnimationDriver, MockAnimationPlayer} from '@angular/animations/browser/testing';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
@ -259,7 +260,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -337,7 +338,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -403,7 +404,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -483,7 +484,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -558,7 +559,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -610,7 +611,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -669,7 +670,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -722,7 +723,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -779,7 +780,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -831,7 +832,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -893,7 +894,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -939,7 +940,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -991,7 +992,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1053,7 +1054,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1134,7 +1135,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1208,7 +1209,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -1287,7 +1288,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
@ -1355,7 +1356,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1408,7 +1409,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1471,7 +1472,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1541,7 +1542,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1596,7 +1597,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1855,7 +1856,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1915,7 +1916,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -1985,7 +1986,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2038,7 +2039,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2108,7 +2109,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2161,7 +2162,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2213,7 +2214,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2360,7 +2361,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2481,7 +2482,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
const container = fixture.elementRef.nativeElement;
|
||||
|
@ -2568,7 +2569,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.loading = true;
|
||||
|
@ -2665,7 +2666,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -2708,7 +2709,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
fixture.detectChanges();
|
||||
engine.flush();
|
||||
|
@ -2728,7 +2729,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
expect(players.length).toEqual(2);
|
||||
expect(engine.players.length).toEqual(1);
|
||||
|
||||
expect(engine.players[0].getRealPlayer()).toBe(players[1]);
|
||||
expect((engine.players[0] as TransitionAnimationPlayer).getRealPlayer()).toBe(players[1]);
|
||||
});
|
||||
|
||||
it('should fire and synchronize the start/done callbacks on sub triggers even if they are not allowed to animate within the animation',
|
||||
|
@ -2793,7 +2794,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
fixture.detectChanges();
|
||||
flushMicrotasks();
|
||||
|
@ -2896,7 +2897,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
fixture.detectChanges();
|
||||
flushMicrotasks();
|
||||
|
@ -2952,7 +2953,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
fixture.detectChanges();
|
||||
engine.flush();
|
||||
|
@ -2967,7 +2968,8 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
engine.flush();
|
||||
|
||||
expect(engine.players.length).toEqual(1); // child player, parent cover, parent player
|
||||
const groupPlayer = engine.players[0].getRealPlayer() as AnimationGroupPlayer;
|
||||
const groupPlayer = (engine.players[0] as TransitionAnimationPlayer)
|
||||
.getRealPlayer() as AnimationGroupPlayer;
|
||||
const childPlayer = groupPlayer.players.find(player => {
|
||||
if (player instanceof MockAnimationPlayer) {
|
||||
return matchesElement(player.element, '.child');
|
||||
|
@ -3044,7 +3046,7 @@ import {HostListener} from '../../src/metadata/directives';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, ChildCmp, GrandChildCmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
fixture.detectChanges();
|
||||
engine.flush();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
import {animate, animateChild, group, query, sequence, style, transition, trigger, ɵAnimationGroupPlayer as AnimationGroupPlayer} from '@angular/animations';
|
||||
import {AnimationDriver, ɵAnimationEngine} from '@angular/animations/browser';
|
||||
import {TransitionAnimationPlayer} from '@angular/animations/browser/src/render/transition_animation_engine';
|
||||
import {MockAnimationDriver, MockAnimationPlayer} from '@angular/animations/browser/testing';
|
||||
import {Component, HostBinding} from '@angular/core';
|
||||
import {TestBed, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
||||
|
@ -111,7 +112,7 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
])]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ContainerCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.router.initialNavigation();
|
||||
|
@ -130,7 +131,8 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
engine.flush();
|
||||
|
||||
const player = engine.players[0] !;
|
||||
const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
|
||||
const groupPlayer =
|
||||
(player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer;
|
||||
const players = groupPlayer.players as MockAnimationPlayer[];
|
||||
|
||||
expect(players.length).toEqual(2);
|
||||
|
@ -218,7 +220,7 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
])]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ContainerCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.router.initialNavigation();
|
||||
|
@ -237,7 +239,8 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
engine.flush();
|
||||
|
||||
const player = engine.players[0] !;
|
||||
const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
|
||||
const groupPlayer =
|
||||
(player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer;
|
||||
const players = groupPlayer.players as MockAnimationPlayer[];
|
||||
|
||||
expect(players.length).toEqual(2);
|
||||
|
@ -322,7 +325,7 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
])]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ContainerCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.router.initialNavigation();
|
||||
|
@ -341,7 +344,8 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
engine.flush();
|
||||
|
||||
const player = engine.players[0] !;
|
||||
const groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
|
||||
const groupPlayer =
|
||||
(player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer;
|
||||
const players = groupPlayer.players as MockAnimationPlayer[];
|
||||
|
||||
expect(players.length).toEqual(2);
|
||||
|
@ -413,7 +417,7 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
])]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(ContainerCmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.router.initialNavigation();
|
||||
|
@ -437,10 +441,11 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
expect(players.length).toEqual(1);
|
||||
const [p1] = players;
|
||||
|
||||
const innerPlayers = p1.getRealPlayer().players;
|
||||
const innerPlayers =
|
||||
((p1 as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer).players;
|
||||
expect(innerPlayers.length).toEqual(2);
|
||||
|
||||
const [ip1, ip2] = innerPlayers;
|
||||
const [ip1, ip2] = innerPlayers as any;
|
||||
expect(ip1.element.innerText).toEqual('page1');
|
||||
expect(ip2.element.innerText).toEqual('page2');
|
||||
}));
|
||||
|
|
|
@ -54,7 +54,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -109,7 +109,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -172,7 +172,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -223,7 +223,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -286,7 +286,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -298,7 +298,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
expect(foo.style.getPropertyValue('max-height')).toEqual('0px');
|
||||
|
||||
const player = engine.players.pop();
|
||||
const player = engine.players.pop() !;
|
||||
player.finish();
|
||||
|
||||
expect(foo.style.getPropertyValue('max-height')).toBeFalsy();
|
||||
|
@ -334,7 +334,7 @@ import {TestBed} from '../../testing';
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -348,7 +348,7 @@ import {TestBed} from '../../testing';
|
|||
expect(elm.style.getPropertyValue('display')).toEqual('inline');
|
||||
expect(elm.style.getPropertyValue('position')).toEqual('absolute');
|
||||
|
||||
const player = engine.players.pop();
|
||||
const player = engine.players.pop() !;
|
||||
player.finish();
|
||||
player.destroy();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -61,7 +61,8 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
expect(engine.players.length).toEqual(1);
|
||||
let webPlayer = engine.players[0].getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
let webPlayer =
|
||||
(engine.players[0] as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '0px', offset: 0}, {height: '100px', offset: 1}
|
||||
|
@ -75,7 +76,8 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
engine.flush();
|
||||
|
||||
expect(engine.players.length).toEqual(1);
|
||||
webPlayer = engine.players[0].getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
webPlayer = (engine.players[0] as TransitionAnimationPlayer)
|
||||
.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '100px', offset: 0}, {height: '0px', offset: 1}
|
||||
|
@ -106,7 +108,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -115,7 +117,8 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
engine.flush();
|
||||
|
||||
expect(engine.players.length).toEqual(1);
|
||||
let webPlayer = engine.players[0].getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
let webPlayer =
|
||||
(engine.players[0] as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '100px', offset: 0}, {height: '120px', offset: 1}
|
||||
|
@ -144,7 +147,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -154,7 +157,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
expect(engine.players.length).toEqual(1);
|
||||
let player = engine.players[0];
|
||||
let webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
let webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '0px', offset: 0}, {height: '100px', offset: 1}
|
||||
|
@ -172,7 +175,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
expect(engine.players.length).toEqual(1);
|
||||
player = engine.players[0];
|
||||
webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '100px', offset: 0}, {height: '80px', offset: 1}
|
||||
|
@ -215,7 +218,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -223,7 +226,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
let player = engine.players[0] !;
|
||||
let webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
let webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '0px', offset: 0},
|
||||
{height: '300px', offset: 1},
|
||||
|
@ -234,7 +237,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
player = engine.players[0] !;
|
||||
webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
expect(webPlayer.keyframes).toEqual([
|
||||
{height: '300px', offset: 0},
|
||||
{height: '0px', offset: 1},
|
||||
|
@ -295,7 +298,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -308,7 +311,9 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
player = engine.players[0] !as TransitionAnimationPlayer;
|
||||
let queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
|
||||
let queriedPlayers =
|
||||
((player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer)
|
||||
.players;
|
||||
expect(queriedPlayers.length).toEqual(5);
|
||||
|
||||
let i = 0;
|
||||
|
@ -325,7 +330,9 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
player = engine.players[0] !as TransitionAnimationPlayer;
|
||||
queriedPlayers = (player.getRealPlayer() as AnimationGroupPlayer).players;
|
||||
queriedPlayers =
|
||||
((player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer)
|
||||
.players;
|
||||
expect(queriedPlayers.length).toEqual(5);
|
||||
|
||||
for (i = 0; i < queriedPlayers.length; i++) {
|
||||
|
@ -364,7 +371,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -372,14 +379,14 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
let player = engine.players[0] !;
|
||||
let webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
let webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
webPlayer.setPosition(0.5);
|
||||
|
||||
cmp.exp = 'b';
|
||||
fixture.detectChanges();
|
||||
|
||||
player = engine.players[0] !;
|
||||
webPlayer = player.getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
webPlayer = (player as TransitionAnimationPlayer).getRealPlayer() as ɵWebAnimationsPlayer;
|
||||
expect(approximate(parseFloat(webPlayer.keyframes[0]['width'] as string), 150))
|
||||
.toBeLessThan(0.05);
|
||||
expect(approximate(parseFloat(webPlayer.keyframes[0]['height'] as string), 300))
|
||||
|
@ -419,7 +426,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -428,7 +435,8 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
let player = engine.players[0] !;
|
||||
let groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
|
||||
let groupPlayer =
|
||||
(player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer;
|
||||
let players = groupPlayer.players;
|
||||
expect(players.length).toEqual(5);
|
||||
|
||||
|
@ -442,7 +450,8 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
fixture.detectChanges();
|
||||
|
||||
player = engine.players[0];
|
||||
groupPlayer = player.getRealPlayer() as AnimationGroupPlayer;
|
||||
groupPlayer =
|
||||
(player as TransitionAnimationPlayer).getRealPlayer() as AnimationGroupPlayer;
|
||||
players = groupPlayer.players;
|
||||
|
||||
expect(players.length).toEqual(5);
|
||||
|
@ -485,7 +494,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -499,7 +508,7 @@ import {browserDetection} from '@angular/platform-browser/testing/src/browser_ut
|
|||
expect(elm.style.getPropertyValue('display')).toEqual('inline');
|
||||
expect(elm.style.getPropertyValue('position')).toEqual('absolute');
|
||||
|
||||
const player = engine.players.pop();
|
||||
const player = engine.players.pop() !;
|
||||
player.finish();
|
||||
player.destroy();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class SomeComponent {
|
|||
beforeEach(() => { mockConsole = new MockConsole(); });
|
||||
|
||||
function createRootEl(selector = 'bootstrap-app') {
|
||||
const doc = TestBed.get(DOCUMENT);
|
||||
const doc = TestBed.inject(DOCUMENT);
|
||||
const rootEl =
|
||||
<HTMLElement>getContent(createTemplate(`<${selector}></${selector}>`)).firstChild;
|
||||
const oldRoots = doc.querySelectorAll(selector);
|
||||
|
@ -160,7 +160,7 @@ class SomeComponent {
|
|||
|
||||
const fixture = TestBed.configureTestingModule({declarations: [ReenteringComponent]})
|
||||
.createComponent(ReenteringComponent);
|
||||
const appRef = TestBed.get(ApplicationRef) as ApplicationRef;
|
||||
const appRef = TestBed.inject(ApplicationRef);
|
||||
appRef.attachView(fixture.componentRef.hostView);
|
||||
appRef.tick();
|
||||
expect(fixture.componentInstance.reenterErr.message)
|
||||
|
@ -437,7 +437,7 @@ class SomeComponent {
|
|||
|
||||
it('should dirty check attached views', () => {
|
||||
const comp = TestBed.createComponent(MyComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
expect(appRef.viewCount).toBe(0);
|
||||
|
||||
appRef.tick();
|
||||
|
@ -451,7 +451,7 @@ class SomeComponent {
|
|||
|
||||
it('should not dirty check detached views', () => {
|
||||
const comp = TestBed.createComponent(MyComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
|
||||
appRef.attachView(comp.componentRef.hostView);
|
||||
appRef.tick();
|
||||
|
@ -466,7 +466,7 @@ class SomeComponent {
|
|||
|
||||
it('should detach attached views if they are destroyed', () => {
|
||||
const comp = TestBed.createComponent(MyComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
|
||||
appRef.attachView(comp.componentRef.hostView);
|
||||
comp.destroy();
|
||||
|
@ -476,7 +476,7 @@ class SomeComponent {
|
|||
|
||||
it('should detach attached embedded views if they are destroyed', () => {
|
||||
const comp = TestBed.createComponent(EmbeddedViewComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
|
||||
const embeddedViewRef = comp.componentInstance.tplRef.createEmbeddedView({});
|
||||
|
||||
|
@ -494,7 +494,7 @@ class SomeComponent {
|
|||
const containerComp = TestBed.createComponent(ContainerComp);
|
||||
containerComp.detectChanges();
|
||||
const vc = containerComp.componentInstance.vc;
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
|
||||
vc.insert(hostView);
|
||||
expect(() => appRef.attachView(hostView))
|
||||
|
@ -578,8 +578,8 @@ class SomeComponent {
|
|||
|
||||
function expectStableTexts(component: Type<any>, expected: string[]) {
|
||||
const fixture = TestBed.createComponent(component);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const zone: NgZone = TestBed.get(NgZone);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
const zone: NgZone = TestBed.inject(NgZone);
|
||||
appRef.attachView(fixture.componentRef.hostView);
|
||||
zone.run(() => appRef.tick());
|
||||
|
||||
|
@ -631,8 +631,8 @@ class SomeComponent {
|
|||
|
||||
it('should be fired after app becomes unstable', async(() => {
|
||||
const fixture = TestBed.createComponent(ClickComp);
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const zone: NgZone = TestBed.get(NgZone);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
const zone: NgZone = TestBed.inject(NgZone);
|
||||
appRef.attachView(fixture.componentRef.hostView);
|
||||
zone.run(() => appRef.tick());
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('forwardRef integration', function() {
|
|||
const a = TestBed.configureTestingModule({schemas: [NO_ERRORS_SCHEMA]}).createComponent(App);
|
||||
a.detectChanges();
|
||||
expect(asNativeElements(a.debugElement.children)).toHaveText('frame(lock)');
|
||||
expect(TestBed.get(ModuleFrame)).toBeDefined();
|
||||
expect(TestBed.inject(ModuleFrame)).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
|||
}
|
||||
|
||||
function initHelpers(): void {
|
||||
renderLog = TestBed.get(RenderLog);
|
||||
directiveLog = TestBed.get(DirectiveLog);
|
||||
patchLoggingRenderer2(TestBed.get(RendererFactory2), renderLog);
|
||||
renderLog = TestBed.inject(RenderLog);
|
||||
directiveLog = TestBed.inject(DirectiveLog);
|
||||
patchLoggingRenderer2(TestBed.inject(RendererFactory2), renderLog);
|
||||
}
|
||||
|
||||
function queryDirs(el: DebugElement, dirType: Type<any>): any {
|
||||
|
@ -682,7 +682,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
|
|||
it('should call the begin and end methods on the renderer factory when change detection is called',
|
||||
fakeAsync(() => {
|
||||
const ctx = createCompFixture('<div testDirective [a]="42"></div>');
|
||||
const rf = TestBed.get(RendererFactory2);
|
||||
const rf = TestBed.inject(RendererFactory2);
|
||||
spyOn(rf, 'begin');
|
||||
spyOn(rf, 'end');
|
||||
expect(rf.begin).not.toHaveBeenCalled();
|
||||
|
|
|
@ -859,7 +859,7 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
const template = '<div listener></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
const doc = TestBed.get(DOCUMENT);
|
||||
const doc = TestBed.inject(DOCUMENT);
|
||||
|
||||
const tc = fixture.debugElement.children[0];
|
||||
const listener = tc.injector.get(DirectiveListeningDomEvent);
|
||||
|
@ -1013,7 +1013,7 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
const template = '<div *ngIf="ctxBoolProp" listener listenerother></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
const doc = TestBed.get(DOCUMENT);
|
||||
const doc = TestBed.inject(DOCUMENT);
|
||||
|
||||
globalCounter = 0;
|
||||
fixture.componentInstance.ctxBoolProp = true;
|
||||
|
@ -1113,7 +1113,7 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
|
||||
const compFixture =
|
||||
TestBed.configureTestingModule({imports: [RootModule]}).createComponent(RootComp);
|
||||
const compiler = <Compiler>TestBed.get(Compiler);
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const myCompFactory =
|
||||
<ComponentFactory<MyComp>>compiler.compileModuleAndAllComponentsSync(MyModule)
|
||||
.componentFactories[0];
|
||||
|
@ -1150,10 +1150,11 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
|
||||
const compFixture =
|
||||
TestBed.configureTestingModule({imports: [RootModule]}).createComponent(RootComp);
|
||||
const compiler = <Compiler>TestBed.get(Compiler);
|
||||
const myModule = compiler.compileModuleSync(MyModule).create(TestBed.get(NgModuleRef));
|
||||
const myCompFactory = (<ComponentFactoryResolver>TestBed.get(ComponentFactoryResolver))
|
||||
.resolveComponentFactory(MyComp);
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const myModule =
|
||||
compiler.compileModuleSync(MyModule).create(TestBed.inject(NgModuleRef).injector);
|
||||
const myCompFactory =
|
||||
TestBed.inject(ComponentFactoryResolver).resolveComponentFactory(MyComp);
|
||||
|
||||
// Note: MyComp was declared as entryComponent in the RootModule,
|
||||
// but we pass MyModule to the createComponent call.
|
||||
|
@ -1192,9 +1193,9 @@ function declareTests(config?: {useJit: boolean}) {
|
|||
|
||||
const compFixture = TestBed.configureTestingModule({imports: [RootModule]})
|
||||
.createComponent(RootComp);
|
||||
const compiler = <Compiler>TestBed.get(Compiler);
|
||||
const myModule =
|
||||
compiler.compileModuleSync(MyModule).create(TestBed.get(NgModuleRef));
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const myModule = compiler.compileModuleSync(MyModule).create(
|
||||
TestBed.inject(NgModuleRef).injector);
|
||||
const myCompFactory =
|
||||
myModule.componentFactoryResolver.resolveComponentFactory(MyComp);
|
||||
|
||||
|
|
|
@ -80,8 +80,7 @@ import {obsoleteInIvy} from '@angular/private/testing';
|
|||
TestBed.configureTestingModule({imports: [SomeModule], providers: [SomeDep]});
|
||||
|
||||
let summariesPromise = TestBed.compileComponents().then(() => {
|
||||
const metadataResolver =
|
||||
TestBed.get(CompileMetadataResolver) as CompileMetadataResolver;
|
||||
const metadataResolver = TestBed.inject(CompileMetadataResolver);
|
||||
const summaries = [
|
||||
metadataResolver.getNgModuleSummary(SomeModule),
|
||||
// test nesting via closures, as we use this in the generated code too.
|
||||
|
@ -174,7 +173,7 @@ import {obsoleteInIvy} from '@angular/private/testing';
|
|||
TestBed.configureTestingModule({
|
||||
providers: [SomeService, SomeDep],
|
||||
});
|
||||
TestBed.get(SomeService);
|
||||
TestBed.inject(SomeService);
|
||||
expectInstanceCreated(SomeService);
|
||||
});
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ describe('projection', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({imports: [MyModule]});
|
||||
const injector: Injector = TestBed.get(Injector);
|
||||
const injector: Injector = TestBed.inject(Injector);
|
||||
|
||||
const componentFactoryResolver: ComponentFactoryResolver =
|
||||
injector.get(ComponentFactoryResolver);
|
||||
|
@ -168,7 +168,7 @@ describe('projection', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({imports: [MyModule]});
|
||||
const injector: Injector = TestBed.get(Injector);
|
||||
const injector: Injector = TestBed.inject(Injector);
|
||||
|
||||
const componentFactoryResolver: ComponentFactoryResolver =
|
||||
injector.get(ComponentFactoryResolver);
|
||||
|
|
|
@ -201,7 +201,7 @@ describe('jit source mapping', () => {
|
|||
const comp = compileAndCreateComponent(MyComp);
|
||||
|
||||
let error: any;
|
||||
const errorHandler = TestBed.get(ErrorHandler);
|
||||
const errorHandler = TestBed.inject(ErrorHandler);
|
||||
spyOn(errorHandler, 'handleError').and.callFake((e: any) => error = e);
|
||||
comp.debugElement.children[0].children[0].triggerEventHandler('click', 'EVENT');
|
||||
expect(error).toBeTruthy();
|
||||
|
@ -381,7 +381,7 @@ describe('jit source mapping', () => {
|
|||
const comp = resolveCompileAndCreateComponent(MyComp, template);
|
||||
|
||||
let error: any;
|
||||
const errorHandler = TestBed.get(ErrorHandler);
|
||||
const errorHandler = TestBed.inject(ErrorHandler);
|
||||
spyOn(errorHandler, 'handleError').and.callFake((e: any) => error = e);
|
||||
try {
|
||||
comp.debugElement.children[0].children[0].triggerEventHandler('click', 'EVENT');
|
||||
|
|
|
@ -254,7 +254,7 @@ describe('TestBed', () => {
|
|||
imports: [MyModule.forRoot()],
|
||||
});
|
||||
|
||||
const service = TestBed.get(MyService);
|
||||
const service = TestBed.inject(MyService);
|
||||
expect(service.get()).toEqual('override');
|
||||
});
|
||||
|
||||
|
@ -283,7 +283,7 @@ describe('TestBed', () => {
|
|||
providers: [{provide: MyService, useValue: serviceOverride}],
|
||||
});
|
||||
|
||||
const service = TestBed.get(MyService);
|
||||
const service = TestBed.inject(MyService);
|
||||
expect(service.get()).toEqual('override');
|
||||
});
|
||||
|
||||
|
@ -381,7 +381,7 @@ describe('TestBed', () => {
|
|||
getTestBed().resetTestingModule();
|
||||
TestBed.configureTestingModule({imports: [ProvidesErrorHandler, HelloWorldModule]});
|
||||
|
||||
expect(TestBed.get(ErrorHandler)).toEqual(jasmine.any(CustomErrorHandler));
|
||||
expect(TestBed.inject(ErrorHandler)).toEqual(jasmine.any(CustomErrorHandler));
|
||||
|
||||
});
|
||||
|
||||
|
@ -691,7 +691,7 @@ describe('TestBed', () => {
|
|||
TestBed.configureTestingModule({imports: [Module, Module]});
|
||||
TestBed.overrideProvider(Token, {useValue: {name: 'fake'}});
|
||||
|
||||
expect(TestBed.get(Token).name).toEqual('fake');
|
||||
expect(TestBed.inject(Token).name).toEqual('fake');
|
||||
|
||||
TestBed.resetTestingModule();
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent
|
|||
});
|
||||
|
||||
it('should report debug info on event errors', () => {
|
||||
const handleErrorSpy = spyOn(TestBed.get(ErrorHandler), 'handleError');
|
||||
const handleErrorSpy = spyOn(TestBed.inject(ErrorHandler), 'handleError');
|
||||
const addListenerSpy = spyOn(HTMLElement.prototype, addEventListener).and.callThrough();
|
||||
const {view, rootNodes} = createAndAttachAndGetRootNodes(compViewDef([elementDef(
|
||||
0, NodeFlags.None, null, null, 0, 'button', null, null, [[null !, 'click']],
|
||||
|
|
|
@ -33,8 +33,8 @@ export function createRootView(
|
|||
rootSelectorOrNode?: any): ViewData {
|
||||
initServicesIfNeeded();
|
||||
return Services.createRootView(
|
||||
TestBed.get(Injector), projectableNodes || [], rootSelectorOrNode, def,
|
||||
TestBed.get(NgModuleRef), context);
|
||||
TestBed.inject(Injector), projectableNodes || [], rootSelectorOrNode, def,
|
||||
TestBed.inject(NgModuleRef), context);
|
||||
}
|
||||
|
||||
export function createEmbeddedView(parent: ViewData, anchorDef: NodeDef, context?: any): ViewData {
|
||||
|
@ -96,4 +96,4 @@ export function callMostRecentEventListenerHandler(spy: any, params: any) {
|
|||
const handler = args[1];
|
||||
|
||||
handler && handler.apply(obj, [{type: eventName}]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetR
|
|||
() => compViewDef([textDef(0, null, ['a'])])),
|
||||
directiveDef(1, NodeFlags.Component, null, 0, SomeService, [])
|
||||
]),
|
||||
TestBed.get(Injector), [], getDOM().createElement('div'));
|
||||
TestBed.inject(Injector), [], getDOM().createElement('div'));
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ import {ARG_TYPE_VALUES, checkNodeInlineOrDynamic, createRootView, createAndGetR
|
|||
});
|
||||
|
||||
it('should report debug info on event errors', () => {
|
||||
const handleErrorSpy = spyOn(TestBed.get(ErrorHandler), 'handleError');
|
||||
const handleErrorSpy = spyOn(TestBed.inject(ErrorHandler), 'handleError');
|
||||
let emitter = new EventEmitter<any>();
|
||||
|
||||
class SomeService {
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('HeroesService (from Angular)', () => {
|
|||
|
||||
// #docregion angular-spec
|
||||
it('should have access to the HeroesService', () => {
|
||||
const heroesService = TestBed.get(HeroesService) as HeroesService;
|
||||
const heroesService = TestBed.inject(HeroesService);
|
||||
expect(heroesService).toBeDefined();
|
||||
});
|
||||
// #enddocregion angular-spec
|
||||
|
|
|
@ -88,7 +88,7 @@ if (isBrowser) {
|
|||
TestBed.configureTestingModule({
|
||||
imports: [TestModule],
|
||||
});
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
expect(compiler.getModuleId(TestModule)).toBe('test-module');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -34,13 +34,13 @@ import {el} from '../../testing/src/browser_util';
|
|||
styles: [],
|
||||
data: {'animation': animationTriggers}
|
||||
};
|
||||
return (TestBed.get(RendererFactory2) as AnimationRendererFactory)
|
||||
return (TestBed.inject(RendererFactory2) as AnimationRendererFactory)
|
||||
.createRenderer(element, type);
|
||||
}
|
||||
|
||||
it('should hook into the engine\'s insert operations when appending children', () => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
const container = el('<div></div>');
|
||||
|
||||
renderer.appendChild(container, element);
|
||||
|
@ -50,7 +50,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
it('should hook into the engine\'s insert operations when inserting a child before another',
|
||||
() => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
const container = el('<div></div>');
|
||||
const element2 = el('<div></div>');
|
||||
container.appendChild(element2);
|
||||
|
@ -61,7 +61,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
|
||||
it('should hook into the engine\'s insert operations when removing children', () => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
const container = el('<div></div>');
|
||||
|
||||
renderer.removeChild(container, element);
|
||||
|
@ -70,7 +70,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
|
||||
it('should hook into the engine\'s setProperty call if the property begins with `@`', () => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
|
||||
renderer.setProperty(element, 'prop', 'value');
|
||||
expect(engine.captures['setProperty']).toBeFalsy();
|
||||
|
@ -82,7 +82,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
describe('listen', () => {
|
||||
it('should hook into the engine\'s listen call if the property begins with `@`', () => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
|
||||
const cb = (event: any): boolean => { return true; };
|
||||
|
||||
|
@ -96,7 +96,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
it('should resolve the body|document|window nodes given their values as strings as input',
|
||||
() => {
|
||||
const renderer = makeRenderer();
|
||||
const engine = TestBed.get(AnimationEngine) as MockAnimationEngine;
|
||||
const engine = TestBed.inject(AnimationEngine) as MockAnimationEngine;
|
||||
|
||||
const cb = (event: any): boolean => { return true; };
|
||||
|
||||
|
@ -140,7 +140,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
declarations: [Cmp]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
cmp.exp = 'state';
|
||||
|
@ -225,7 +225,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
declarations: [Cmp]
|
||||
});
|
||||
|
||||
const engine = TestBed.get(AnimationEngine);
|
||||
const engine = TestBed.inject(AnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
@ -295,7 +295,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
declarations: [Cmp]
|
||||
});
|
||||
|
||||
const renderer = TestBed.get(RendererFactory2) as ExtendedAnimationRendererFactory;
|
||||
const renderer = TestBed.inject(RendererFactory2) as ExtendedAnimationRendererFactory;
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [Cmp]});
|
||||
const engine = TestBed.get(ɵAnimationEngine);
|
||||
const engine = TestBed.inject(ɵAnimationEngine);
|
||||
const fixture = TestBed.createComponent(Cmp);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
||||
|
|
|
@ -197,6 +197,6 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
|
|||
});
|
||||
|
||||
it('should inject Meta service when using BrowserModule',
|
||||
() => expect(TestBed.get(DependsOnMeta).meta).toBeAnInstanceOf(Meta));
|
||||
() => expect(TestBed.inject(DependsOnMeta).meta).toBeAnInstanceOf(Meta));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -56,6 +56,6 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
|
|||
});
|
||||
|
||||
it('should inject Title service when using BrowserModule',
|
||||
() => { expect(TestBed.get(DependsOnTitle).title).toBeAnInstanceOf(Title); });
|
||||
() => { expect(TestBed.inject(DependsOnTitle).title).toBeAnInstanceOf(Title); });
|
||||
});
|
||||
}
|
||||
|
|
|
@ -46,52 +46,52 @@ import {StateKey, escapeHtml, makeStateKey, unescapeHtml} from '@angular/platfor
|
|||
BrowserTransferStateModule,
|
||||
]
|
||||
});
|
||||
doc = TestBed.get(DOCUMENT);
|
||||
doc = TestBed.inject(DOCUMENT);
|
||||
});
|
||||
|
||||
afterEach(() => { removeScriptTag(doc, APP_ID + '-state'); });
|
||||
|
||||
it('is initialized from script tag', () => {
|
||||
addScriptTag(doc, APP_ID, {test: 10});
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
expect(transferState.get(TEST_KEY, 0)).toBe(10);
|
||||
});
|
||||
|
||||
it('is initialized to empty state if script tag not found', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
expect(transferState.get(TEST_KEY, 0)).toBe(0);
|
||||
});
|
||||
|
||||
it('supports adding new keys using set', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, 20);
|
||||
expect(transferState.get(TEST_KEY, 0)).toBe(20);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
it('supports setting and accessing value \'0\' via get', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, 0);
|
||||
expect(transferState.get(TEST_KEY, 20)).toBe(0);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
it('supports setting and accessing value \'false\' via get', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, false);
|
||||
expect(transferState.get(TEST_KEY, true)).toBe(false);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
it('supports setting and accessing value \'null\' via get', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, null);
|
||||
expect(transferState.get(TEST_KEY, 20 as any)).toBe(null);
|
||||
expect(transferState.hasKey(TEST_KEY)).toBe(true);
|
||||
});
|
||||
|
||||
it('supports removing keys', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, 20);
|
||||
transferState.remove(TEST_KEY);
|
||||
expect(transferState.get(TEST_KEY, 0)).toBe(0);
|
||||
|
@ -99,13 +99,13 @@ import {StateKey, escapeHtml, makeStateKey, unescapeHtml} from '@angular/platfor
|
|||
});
|
||||
|
||||
it('supports serialization using toJson()', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, 20);
|
||||
expect(transferState.toJson()).toBe('{"test":20}');
|
||||
});
|
||||
|
||||
it('calls onSerialize callbacks when calling toJson()', () => {
|
||||
const transferState: TransferState = TestBed.get(TransferState);
|
||||
const transferState: TransferState = TestBed.inject(TransferState);
|
||||
transferState.set(TEST_KEY, 20);
|
||||
|
||||
let value = 'initial';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {CompilerConfig, ResourceLoader} from '@angular/compiler';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, Directive, Inject, Injectable, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, Directive, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
||||
import {TestBed, async, fakeAsync, getTestBed, inject, tick, withModule} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {ivyEnabled, modifiedInIvy, obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
|
||||
|
@ -112,6 +112,9 @@ class SomeLibModule {
|
|||
class CompWithUrlTemplate {
|
||||
}
|
||||
|
||||
const aTok = new InjectionToken<string>('a');
|
||||
const bTok = new InjectionToken<string>('b');
|
||||
|
||||
{
|
||||
describe('public testing API', () => {
|
||||
describe('using the async helper with context passing', () => {
|
||||
|
@ -416,55 +419,56 @@ class CompWithUrlTemplate {
|
|||
|
||||
describe('overriding providers', () => {
|
||||
describe('in NgModules', () => {
|
||||
|
||||
it('should support useValue', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
});
|
||||
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
||||
expect(TestBed.get('a')).toBe('mockValue');
|
||||
TestBed.overrideProvider(aTok, {useValue: 'mockValue'});
|
||||
expect(TestBed.inject(aTok)).toBe('mockValue');
|
||||
});
|
||||
|
||||
it('should support useFactory', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
});
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
||||
expect(TestBed.get('a')).toBe('mockA: depValue');
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
||||
expect(TestBed.inject(aTok)).toBe('mockA: depValue');
|
||||
});
|
||||
|
||||
it('should support @Optional without matches', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
});
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
expect(TestBed.get('a')).toBe('mockA: null');
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
expect(TestBed.inject(aTok)).toBe('mockA: null');
|
||||
});
|
||||
|
||||
it('should support Optional with matches', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
});
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
expect(TestBed.get('a')).toBe('mockA: depValue');
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
expect(TestBed.inject(aTok)).toBe('mockA: depValue');
|
||||
});
|
||||
|
||||
it('should support SkipSelf', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
]
|
||||
})
|
||||
|
@ -472,13 +476,14 @@ class CompWithUrlTemplate {
|
|||
}
|
||||
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||
TestBed.configureTestingModule(
|
||||
{providers: [{provide: 'dep', useValue: 'parentDepValue'}]});
|
||||
|
||||
const compiler = TestBed.get(Compiler) as Compiler;
|
||||
const compiler = TestBed.inject(Compiler);
|
||||
const modFactory = compiler.compileModuleSync(MyModule);
|
||||
expect(modFactory.create(getTestBed()).injector.get('a')).toBe('mockA: parentDepValue');
|
||||
expect(modFactory.create(getTestBed()).injector.get(aTok))
|
||||
.toBe('mockA: parentDepValue');
|
||||
});
|
||||
|
||||
it('should keep imported NgModules eager', () => {
|
||||
|
@ -491,42 +496,42 @@ class CompWithUrlTemplate {
|
|||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
],
|
||||
imports: [SomeModule]
|
||||
});
|
||||
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
||||
TestBed.overrideProvider(aTok, {useValue: 'mockValue'});
|
||||
|
||||
expect(TestBed.get('a')).toBe('mockValue');
|
||||
expect(TestBed.inject(aTok)).toBe('mockValue');
|
||||
expect(someModule).toBeAnInstanceOf(SomeModule);
|
||||
});
|
||||
|
||||
describe('injecting eager providers into an eager overwritten provider', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
{provide: 'a', useFactory: () => 'aValue'},
|
||||
{provide: 'b', useFactory: () => 'bValue'},
|
||||
{provide: aTok, useFactory: () => 'aValue'},
|
||||
{provide: bTok, useFactory: () => 'bValue'},
|
||||
]
|
||||
})
|
||||
class MyModule {
|
||||
// NgModule is eager, which makes all of its deps eager
|
||||
constructor(@Inject('a') a: any, @Inject('b') b: any) {}
|
||||
constructor(@Inject(aTok) a: any, @Inject(bTok) b: any) {}
|
||||
}
|
||||
|
||||
it('should inject providers that were declared before', () => {
|
||||
TestBed.configureTestingModule({imports: [MyModule]});
|
||||
TestBed.overrideProvider(
|
||||
'b', {useFactory: (a: string) => `mockB: ${a}`, deps: ['a']});
|
||||
bTok, {useFactory: (a: string) => `mockB: ${a}`, deps: [aTok]});
|
||||
|
||||
expect(TestBed.get('b')).toBe('mockB: aValue');
|
||||
expect(TestBed.inject(bTok)).toBe('mockB: aValue');
|
||||
});
|
||||
|
||||
it('should inject providers that were declared afterwards', () => {
|
||||
TestBed.configureTestingModule({imports: [MyModule]});
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (b: string) => `mockA: ${b}`, deps: ['b']});
|
||||
aTok, {useFactory: (b: string) => `mockA: ${b}`, deps: [bTok]});
|
||||
|
||||
expect(TestBed.get('a')).toBe('mockA: bValue');
|
||||
expect(TestBed.inject(aTok)).toBe('mockA: bValue');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -536,17 +541,17 @@ class CompWithUrlTemplate {
|
|||
@Component({
|
||||
template: '',
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
})
|
||||
class MComp {
|
||||
}
|
||||
|
||||
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
||||
TestBed.overrideProvider(aTok, {useValue: 'mockValue'});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MComp]}).createComponent(MComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('a')).toBe('mockValue');
|
||||
expect(ctx.debugElement.injector.get(aTok)).toBe('mockValue');
|
||||
});
|
||||
|
||||
it('should support useFactory', () => {
|
||||
|
@ -554,36 +559,36 @@ class CompWithUrlTemplate {
|
|||
template: '',
|
||||
providers: [
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
})
|
||||
class MyComp {
|
||||
}
|
||||
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
||||
expect(ctx.debugElement.injector.get(aTok)).toBe('mockA: depValue');
|
||||
});
|
||||
|
||||
it('should support @Optional without matches', () => {
|
||||
@Component({
|
||||
template: '',
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
})
|
||||
class MyComp {
|
||||
}
|
||||
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: null');
|
||||
expect(ctx.debugElement.injector.get(aTok)).toBe('mockA: null');
|
||||
});
|
||||
|
||||
it('should support Optional with matches', () => {
|
||||
|
@ -591,25 +596,25 @@ class CompWithUrlTemplate {
|
|||
template: '',
|
||||
providers: [
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
]
|
||||
})
|
||||
class MyComp {
|
||||
}
|
||||
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
||||
expect(ctx.debugElement.injector.get(aTok)).toBe('mockA: depValue');
|
||||
});
|
||||
|
||||
it('should support SkipSelf', () => {
|
||||
@Directive({
|
||||
selector: '[myDir]',
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue'},
|
||||
{provide: aTok, useValue: 'aValue'},
|
||||
{provide: 'dep', useValue: 'depValue'},
|
||||
]
|
||||
})
|
||||
|
@ -626,17 +631,17 @@ class CompWithUrlTemplate {
|
|||
}
|
||||
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||
aTok, {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir]})
|
||||
.createComponent(MyComp);
|
||||
expect(ctx.debugElement.children[0].injector.get('a')).toBe('mockA: parentDepValue');
|
||||
expect(ctx.debugElement.children[0].injector.get(aTok)).toBe('mockA: parentDepValue');
|
||||
});
|
||||
|
||||
it('should support multiple providers in a template', () => {
|
||||
@Directive({
|
||||
selector: '[myDir1]',
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue1'},
|
||||
{provide: aTok, useValue: 'aValue1'},
|
||||
]
|
||||
})
|
||||
class MyDir1 {
|
||||
|
@ -645,7 +650,7 @@ class CompWithUrlTemplate {
|
|||
@Directive({
|
||||
selector: '[myDir2]',
|
||||
providers: [
|
||||
{provide: 'a', useValue: 'aValue2'},
|
||||
{provide: aTok, useValue: 'aValue2'},
|
||||
]
|
||||
})
|
||||
class MyDir2 {
|
||||
|
@ -657,51 +662,51 @@ class CompWithUrlTemplate {
|
|||
class MyComp {
|
||||
}
|
||||
|
||||
TestBed.overrideProvider('a', {useValue: 'mockA'});
|
||||
TestBed.overrideProvider(aTok, {useValue: 'mockA'});
|
||||
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir1, MyDir2]})
|
||||
.createComponent(MyComp);
|
||||
expect(ctx.debugElement.children[0].injector.get('a')).toBe('mockA');
|
||||
expect(ctx.debugElement.children[1].injector.get('a')).toBe('mockA');
|
||||
expect(ctx.debugElement.children[0].injector.get(aTok)).toBe('mockA');
|
||||
expect(ctx.debugElement.children[1].injector.get(aTok)).toBe('mockA');
|
||||
});
|
||||
|
||||
describe('injecting eager providers into an eager overwritten provider', () => {
|
||||
@Component({
|
||||
template: '',
|
||||
providers: [
|
||||
{provide: 'a', useFactory: () => 'aValue'},
|
||||
{provide: 'b', useFactory: () => 'bValue'},
|
||||
{provide: aTok, useFactory: () => 'aValue'},
|
||||
{provide: bTok, useFactory: () => 'bValue'},
|
||||
]
|
||||
})
|
||||
class MyComp {
|
||||
// Component is eager, which makes all of its deps eager
|
||||
constructor(@Inject('a') a: any, @Inject('b') b: any) {}
|
||||
constructor(@Inject(aTok) a: any, @Inject(bTok) b: any) {}
|
||||
}
|
||||
|
||||
it('should inject providers that were declared before it', () => {
|
||||
TestBed.overrideProvider(
|
||||
'b', {useFactory: (a: string) => `mockB: ${a}`, deps: ['a']});
|
||||
bTok, {useFactory: (a: string) => `mockB: ${a}`, deps: [aTok]});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('b')).toBe('mockB: aValue');
|
||||
expect(ctx.debugElement.injector.get(bTok)).toBe('mockB: aValue');
|
||||
});
|
||||
|
||||
it('should inject providers that were declared after it', () => {
|
||||
TestBed.overrideProvider(
|
||||
'a', {useFactory: (b: string) => `mockA: ${b}`, deps: ['b']});
|
||||
aTok, {useFactory: (b: string) => `mockA: ${b}`, deps: [bTok]});
|
||||
const ctx =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
||||
|
||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: bValue');
|
||||
expect(ctx.debugElement.injector.get(aTok)).toBe('mockA: bValue');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should reset overrides when the testing modules is resetted', () => {
|
||||
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
||||
TestBed.overrideProvider(aTok, {useValue: 'mockValue'});
|
||||
TestBed.resetTestingModule();
|
||||
TestBed.configureTestingModule({providers: [{provide: 'a', useValue: 'aValue'}]});
|
||||
expect(TestBed.get('a')).toBe('aValue');
|
||||
TestBed.configureTestingModule({providers: [{provide: aTok, useValue: 'aValue'}]});
|
||||
expect(TestBed.inject(aTok)).toBe('aValue');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -739,7 +744,7 @@ class CompWithUrlTemplate {
|
|||
class MyComponent {
|
||||
}
|
||||
|
||||
TestBed.get(Injector);
|
||||
TestBed.inject(Injector);
|
||||
|
||||
expect(() => TestBed.overrideTemplateUsingTestingModule(MyComponent, 'b'))
|
||||
.toThrowError(
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('applyRedirects', () => {
|
|||
const serializer = new DefaultUrlSerializer();
|
||||
let testModule: NgModuleRef<any>;
|
||||
|
||||
beforeEach(() => { testModule = TestBed.get(NgModuleRef); });
|
||||
beforeEach(() => { testModule = TestBed.inject(NgModuleRef); });
|
||||
|
||||
it('should return the same url tree when no redirects', () => {
|
||||
checkRedirect(
|
||||
|
|
|
@ -439,7 +439,7 @@ describe('Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({imports: [TestModule]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
router.resetConfig([{
|
||||
|
@ -509,7 +509,7 @@ describe('Integration', () => {
|
|||
}
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
const fixture = createRoot(router, RootCmpWithLink);
|
||||
|
||||
|
@ -544,8 +544,8 @@ describe('Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({imports: [TestModule]});
|
||||
|
||||
const router = TestBed.get(Router);
|
||||
const location = TestBed.get(Location);
|
||||
const router = TestBed.inject(Router);
|
||||
const location = TestBed.inject(Location);
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
router.resetConfig([{path: 'record/:id', component: RecordLocationCmp}]);
|
||||
|
@ -1208,8 +1208,8 @@ describe('Integration', () => {
|
|||
// Errors should behave the same for both deferred and eager URL update strategies
|
||||
['deferred', 'eager'].forEach((strat: any) => {
|
||||
it('should dispatch NavigationError after the url has been reset back', fakeAsync(() => {
|
||||
const router: Router = TestBed.get(Router);
|
||||
const location: SpyLocation = TestBed.get(Location);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const location = TestBed.inject(Location) as SpyLocation;
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
router.resetConfig(
|
||||
|
@ -1235,8 +1235,8 @@ describe('Integration', () => {
|
|||
}));
|
||||
|
||||
it('should reset the url with the right state when navigation errors', fakeAsync(() => {
|
||||
const router: Router = TestBed.get(Router);
|
||||
const location: SpyLocation = TestBed.get(Location);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const location = TestBed.inject(Location) as SpyLocation;
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
router.resetConfig([
|
||||
|
@ -1270,7 +1270,7 @@ describe('Integration', () => {
|
|||
|
||||
it('should not trigger another navigation when resetting the url back due to a NavigationError',
|
||||
fakeAsync(() => {
|
||||
const router = TestBed.get(Router);
|
||||
const router = TestBed.inject(Router);
|
||||
router.onSameUrlNavigation = 'reload';
|
||||
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
@ -1302,8 +1302,8 @@ describe('Integration', () => {
|
|||
TestBed.configureTestingModule(
|
||||
{providers: [{provide: 'returnsFalse', useValue: () => false}]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const location: SpyLocation = TestBed.get(Location);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const location = TestBed.inject(Location) as SpyLocation;
|
||||
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
|
@ -1489,7 +1489,7 @@ describe('Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({declarations: [Container]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
const fixture = createRoot(router, Container);
|
||||
const cmp = fixture.componentInstance;
|
||||
|
@ -1791,7 +1791,7 @@ describe('Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
const fixture = createRoot(router, RootCmpWithLink);
|
||||
|
||||
|
@ -1814,7 +1814,7 @@ describe('Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [CmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
let fixture: ComponentFixture<CmpWithLink> = createRoot(router, CmpWithLink);
|
||||
router.resetConfig([{path: 'home', component: SimpleCmp}]);
|
||||
|
@ -1834,7 +1834,7 @@ describe('Integration', () => {
|
|||
class RootCmpWithLink {
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, RootCmpWithLink);
|
||||
|
||||
router.resetConfig([{path: 'home', component: SimpleCmp}]);
|
||||
|
@ -1864,7 +1864,7 @@ describe('Integration', () => {
|
|||
class RootCmpWithLink {
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, RootCmpWithLink);
|
||||
|
||||
router.resetConfig([{path: 'home', component: SimpleCmp}]);
|
||||
|
@ -1886,7 +1886,7 @@ describe('Integration', () => {
|
|||
class RootCmpWithLink {
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, RootCmpWithLink);
|
||||
|
||||
router.resetConfig([{path: 'home', component: SimpleCmp}]);
|
||||
|
@ -2058,7 +2058,7 @@ describe('Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithArea]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
const fixture = createRoot(router, RootCmpWithArea);
|
||||
|
||||
|
@ -3687,7 +3687,7 @@ describe('Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [RootCmpWithLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
const f = TestBed.createComponent(RootCmpWithLink);
|
||||
advance(f);
|
||||
|
@ -3772,7 +3772,7 @@ describe('Integration', () => {
|
|||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [ComponentWithRouterLink]});
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
|
||||
router.resetConfig([
|
||||
{
|
||||
|
@ -4397,7 +4397,7 @@ describe('Integration', () => {
|
|||
beforeEach(() => {
|
||||
TestBed.configureTestingModule(
|
||||
{providers: [{provide: PreloadingStrategy, useExisting: PreloadAllModules}]});
|
||||
const preloader = TestBed.get(RouterPreloader);
|
||||
const preloader = TestBed.inject(RouterPreloader);
|
||||
preloader.setUpPreloading();
|
||||
});
|
||||
|
||||
|
@ -4797,7 +4797,7 @@ describe('Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({imports: [TestModule]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
router.routeReuseStrategy = new AttachDetachReuseStrategy();
|
||||
|
||||
const fixture = createRoot(router, RootCmpWithCondOutlet);
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('prioritizedGuardValue operator', () => {
|
|||
|
||||
beforeEach(() => { TestBed.configureTestingModule({imports: [RouterTestingModule]}); });
|
||||
beforeEach(() => { testScheduler = new TestScheduler(assertDeepEquals); });
|
||||
beforeEach(() => { router = TestBed.get(Router); });
|
||||
beforeEach(() => { router = TestBed.inject(Router); });
|
||||
|
||||
it('should return true if all values are true', () => {
|
||||
testScheduler.run(({hot, cold, expectObservable}) => {
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('Integration', () => {
|
|||
|
||||
TestBed.configureTestingModule({imports: [MyModule]});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, MyCmp);
|
||||
router.resetConfig([{path: 'simple', component: SimpleCmp}]);
|
||||
|
||||
|
@ -62,7 +62,7 @@ describe('Integration', () => {
|
|||
template: `
|
||||
<div #rla="routerLinkActive" routerLinkActive>
|
||||
isActive: {{rla.isActive}}
|
||||
|
||||
|
||||
<ng-template let-data>
|
||||
<a [routerLink]="data">link</a>
|
||||
</ng-template>
|
||||
|
@ -94,7 +94,7 @@ describe('Integration', () => {
|
|||
declarations: [ComponentWithRouterLink, SimpleCmp]
|
||||
});
|
||||
|
||||
const router: Router = TestBed.get(Router);
|
||||
const router: Router = TestBed.inject(Router);
|
||||
const fixture = createRoot(router, ComponentWithRouterLink);
|
||||
router.navigateByUrl('/simple');
|
||||
advance(fixture);
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('Router', () => {
|
|||
beforeEach(() => { TestBed.configureTestingModule({imports: [RouterTestingModule]}); });
|
||||
|
||||
it('should copy config to avoid mutations of user-provided objects', () => {
|
||||
const r: Router = TestBed.get(Router);
|
||||
const r: Router = TestBed.inject(Router);
|
||||
const configs: Routes = [{
|
||||
path: 'a',
|
||||
component: TestComponent,
|
||||
|
@ -66,7 +66,7 @@ describe('Router', () => {
|
|||
beforeEach(() => { TestBed.configureTestingModule({imports: [RouterTestingModule]}); });
|
||||
|
||||
it('should not change root route when updating the root component', () => {
|
||||
const r: Router = TestBed.get(Router);
|
||||
const r: Router = TestBed.inject(Router);
|
||||
const root = r.routerState.root;
|
||||
|
||||
(r as any).resetRootComponentType(NewRootComponent);
|
||||
|
|
|
@ -19,7 +19,7 @@ import {ChildrenOutletContexts, ExtraOptions, NoPreloading, PreloadingStrategy,
|
|||
* Allows to simulate the loading of ng modules in tests.
|
||||
*
|
||||
* ```
|
||||
* const loader = TestBed.get(NgModuleFactoryLoader);
|
||||
* const loader = TestBed.inject(NgModuleFactoryLoader);
|
||||
*
|
||||
* @Component({template: 'lazy-loaded'})
|
||||
* class LazyLoadedComponent {}
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('setUpLocationSync', () => {
|
|||
],
|
||||
});
|
||||
|
||||
upgradeModule = TestBed.get(UpgradeModule);
|
||||
upgradeModule = TestBed.inject(UpgradeModule);
|
||||
upgradeModule.$injector = {
|
||||
get: jasmine.createSpy('$injector.get').and.returnValue({'$on': () => undefined})
|
||||
};
|
||||
|
|
|
@ -58,7 +58,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
]
|
||||
});
|
||||
|
||||
expect(TestBed.get(NgswCommChannel).isEnabled).toEqual(false);
|
||||
expect(TestBed.inject(NgswCommChannel).isEnabled).toEqual(false);
|
||||
});
|
||||
it('gives disabled NgswCommChannel when \'enabled\' option is false', () => {
|
||||
TestBed.configureTestingModule({
|
||||
|
@ -72,7 +72,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
]
|
||||
});
|
||||
|
||||
expect(TestBed.get(NgswCommChannel).isEnabled).toEqual(false);
|
||||
expect(TestBed.inject(NgswCommChannel).isEnabled).toEqual(false);
|
||||
});
|
||||
it('gives disabled NgswCommChannel when navigator.serviceWorker is undefined', () => {
|
||||
TestBed.configureTestingModule({
|
||||
|
@ -94,7 +94,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
try {
|
||||
// Set `navigator` to `{serviceWorker: undefined}`.
|
||||
Object.defineProperty(context, 'navigator', patchedDescriptor);
|
||||
expect(TestBed.get(NgswCommChannel).isEnabled).toBe(false);
|
||||
expect(TestBed.inject(NgswCommChannel).isEnabled).toBe(false);
|
||||
} finally {
|
||||
if (originalDescriptor) {
|
||||
Object.defineProperty(context, 'navigator', originalDescriptor);
|
||||
|
@ -123,7 +123,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
try {
|
||||
// Set `navigator` to `{serviceWorker: mock}`.
|
||||
Object.defineProperty(context, 'navigator', patchedDescriptor);
|
||||
expect(TestBed.get(NgswCommChannel).isEnabled).toBe(true);
|
||||
expect(TestBed.inject(NgswCommChannel).isEnabled).toBe(true);
|
||||
} finally {
|
||||
if (originalDescriptor) {
|
||||
Object.defineProperty(context, 'navigator', originalDescriptor);
|
||||
|
@ -154,7 +154,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
{provide: NgswCommChannel, useValue: comm},
|
||||
]
|
||||
});
|
||||
expect(() => TestBed.get(SwPush)).not.toThrow();
|
||||
expect(() => TestBed.inject(SwPush)).not.toThrow();
|
||||
});
|
||||
|
||||
describe('requestSubscription()', () => {
|
||||
|
@ -472,7 +472,7 @@ import {MockPushManager, MockPushSubscription, MockServiceWorkerContainer, MockS
|
|||
{provide: NgswCommChannel, useValue: comm},
|
||||
]
|
||||
});
|
||||
expect(() => TestBed.get(SwUpdate)).not.toThrow();
|
||||
expect(() => TestBed.inject(SwUpdate)).not.toThrow();
|
||||
});
|
||||
describe('with no SW', () => {
|
||||
beforeEach(() => { comm = new NgswCommChannel(undefined); });
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('ServiceWorkerModule', () => {
|
|||
let swRegisterSpy: jasmine.Spy;
|
||||
|
||||
const untilStable = () => {
|
||||
const appRef: ApplicationRef = TestBed.get(ApplicationRef);
|
||||
const appRef: ApplicationRef = TestBed.inject(ApplicationRef);
|
||||
return appRef.isStable.pipe(filter(Boolean), take(1)).toPromise();
|
||||
};
|
||||
|
||||
|
@ -45,28 +45,28 @@ describe('ServiceWorkerModule', () => {
|
|||
it('sets the registration options', async() => {
|
||||
await configTestBed({enabled: true, scope: 'foo'});
|
||||
|
||||
expect(TestBed.get(SwRegistrationOptions)).toEqual({enabled: true, scope: 'foo'});
|
||||
expect(TestBed.inject(SwRegistrationOptions)).toEqual({enabled: true, scope: 'foo'});
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: 'foo'});
|
||||
});
|
||||
|
||||
it('can disable the SW', async() => {
|
||||
await configTestBed({enabled: false});
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(false);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(false);
|
||||
expect(swRegisterSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('can enable the SW', async() => {
|
||||
await configTestBed({enabled: true});
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(true);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(true);
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: undefined});
|
||||
});
|
||||
|
||||
it('defaults to enabling the SW', async() => {
|
||||
await configTestBed({});
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(true);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(true);
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: undefined});
|
||||
});
|
||||
|
||||
|
@ -96,7 +96,7 @@ describe('ServiceWorkerModule', () => {
|
|||
configTestBed({enabled: true, scope: 'provider'});
|
||||
await untilStable();
|
||||
|
||||
expect(TestBed.get(SwRegistrationOptions)).toEqual({enabled: true, scope: 'provider'});
|
||||
expect(TestBed.inject(SwRegistrationOptions)).toEqual({enabled: true, scope: 'provider'});
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: 'provider'});
|
||||
});
|
||||
|
||||
|
@ -104,7 +104,7 @@ describe('ServiceWorkerModule', () => {
|
|||
configTestBed({enabled: false}, {enabled: true});
|
||||
await untilStable();
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(false);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(false);
|
||||
expect(swRegisterSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
@ -112,7 +112,7 @@ describe('ServiceWorkerModule', () => {
|
|||
configTestBed({enabled: true}, {enabled: false});
|
||||
await untilStable();
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(true);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(true);
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: undefined});
|
||||
});
|
||||
|
||||
|
@ -120,7 +120,7 @@ describe('ServiceWorkerModule', () => {
|
|||
configTestBed({}, {enabled: false});
|
||||
await untilStable();
|
||||
|
||||
expect(TestBed.get(SwUpdate).isEnabled).toBe(true);
|
||||
expect(TestBed.inject(SwUpdate).isEnabled).toBe(true);
|
||||
expect(swRegisterSpy).toHaveBeenCalledWith('sw.js', {scope: undefined});
|
||||
});
|
||||
|
||||
|
@ -142,7 +142,7 @@ describe('ServiceWorkerModule', () => {
|
|||
});
|
||||
|
||||
// Dummy `get()` call to initialize the test "app".
|
||||
TestBed.get(ApplicationRef);
|
||||
TestBed.inject(ApplicationRef);
|
||||
|
||||
return isStableSub;
|
||||
};
|
||||
|
|
|
@ -170,8 +170,8 @@ withEachNg1Version(() => {
|
|||
}
|
||||
|
||||
beforeEach(() => {
|
||||
compiler = TestBed.get(Compiler);
|
||||
registry = TestBed.get(TestabilityRegistry);
|
||||
compiler = TestBed.inject(Compiler);
|
||||
registry = TestBed.inject(TestabilityRegistry);
|
||||
adapter = getAdaptor();
|
||||
});
|
||||
beforeEach(() => registry.unregisterAllApplications());
|
||||
|
@ -179,7 +179,7 @@ withEachNg1Version(() => {
|
|||
|
||||
it('should add testabilities hook when creating components', () => {
|
||||
|
||||
let registry = TestBed.get(TestabilityRegistry);
|
||||
let registry = TestBed.inject(TestabilityRegistry);
|
||||
adapter.createComponent([]);
|
||||
expect(registry.getAllTestabilities().length).toEqual(1);
|
||||
|
||||
|
@ -189,7 +189,7 @@ withEachNg1Version(() => {
|
|||
});
|
||||
|
||||
it('should remove the testability hook when destroy a component', () => {
|
||||
const registry = TestBed.get(TestabilityRegistry);
|
||||
const registry = TestBed.inject(TestabilityRegistry);
|
||||
expect(registry.getAllTestabilities().length).toEqual(0);
|
||||
adapter.createComponent([]);
|
||||
expect(registry.getAllTestabilities().length).toEqual(1);
|
||||
|
|
|
@ -93,7 +93,7 @@ export function createAngularJSTestingModule(angularModules: any[]): string {
|
|||
imports: angularModules,
|
||||
providers: [{provide: $INJECTOR, useValue: $injector}]
|
||||
});
|
||||
return TestBed.get(Injector);
|
||||
return TestBed.inject(Injector);
|
||||
}
|
||||
])
|
||||
.name;
|
||||
|
|
|
@ -21,7 +21,7 @@ withEachNg1Version(() => {
|
|||
defineAppModule();
|
||||
// Configure an NgModule that has the Angular and AngularJS injectors wired up
|
||||
TestBed.configureTestingModule({imports: [createAngularTestingModule(['app']), AppModule]});
|
||||
const inventory = TestBed.get(Inventory) as Inventory;
|
||||
const inventory = TestBed.inject(Inventory);
|
||||
expect(inventory.serverRequest).toBe(serverRequestInstance);
|
||||
});
|
||||
|
||||
|
@ -29,20 +29,20 @@ withEachNg1Version(() => {
|
|||
defineAppModule();
|
||||
TestBed.configureTestingModule({imports: [createAngularTestingModule(['app']), AppModule]});
|
||||
// Check that the injectors are wired up correctly
|
||||
TestBed.get(Inventory) as Inventory;
|
||||
TestBed.inject(Inventory);
|
||||
|
||||
// Grab references to the current injectors
|
||||
const injector = TestBed.get(Injector);
|
||||
const $injector = TestBed.get($INJECTOR);
|
||||
const injector = TestBed.inject(Injector);
|
||||
const $injector = TestBed.inject($INJECTOR as any);
|
||||
|
||||
TestBed.resetTestingModule();
|
||||
TestBed.configureTestingModule({imports: [createAngularTestingModule(['app']), AppModule]});
|
||||
// Check that the injectors are wired up correctly
|
||||
TestBed.get(Inventory) as Inventory;
|
||||
TestBed.inject(Inventory);
|
||||
|
||||
// Check that the new injectors are different to the previous ones.
|
||||
expect(TestBed.get(Injector)).not.toBe(injector);
|
||||
expect(TestBed.get($INJECTOR)).not.toBe($injector);
|
||||
expect(TestBed.inject(Injector)).not.toBe(injector);
|
||||
expect(TestBed.inject($INJECTOR as any)).not.toBe($injector);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue