-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): Introduce TestBed.inject to replace TestBed.get #32200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,7 +295,7 @@ describe('ViewContainerRef', () => { | |
const changeDetector = ref.injector.get(ChangeDetectorRef); | ||
changeDetector.detectChanges(); | ||
expect(dynamicComp.doCheckCount).toEqual(1); | ||
expect(changeDetector.context).toEqual(dynamicComp); | ||
expect((changeDetector as any).context).toEqual(dynamicComp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change tells me that this is a painful breaking change that will likely affect lots of code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this is I actually don't expect many breakages from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, this only broke 5-6 targets on google3, affecting about 10-15 files which I already fixed. |
||
}); | ||
|
||
it('should not throw when destroying a reattached component', () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this change is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the "breaking changes" comment, I added
AbstractType<T>
to the "typed version" ofInjector#get
. Previously abstract classes would have returnedany
, the untyped version has been deprecated since Angular 4.xThis caused the returned value here to be type
ElementsLoader
which I thought I could cast directly toTestElementsLoader
but they are apparently not fully compatible since the compiler complained about it