fix(core): throw error message when @Output not initialized (#19116)
Closes #3664 PR Close #19116
This commit is contained in:
@ -346,6 +346,20 @@ function declareTests({useJit}: {useJit: boolean}) {
|
||||
expect(tc.injector.get(EventDir)).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should display correct error message for uninitialized @Output', () => {
|
||||
@Directive({selector: '[uninitializedOuput]'})
|
||||
class UninitializedOuput {
|
||||
@Output() customEvent;
|
||||
doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyComp, UninitializedOuput]});
|
||||
const template = '<p (customEvent)="doNothing()"></p>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
TestBed.createComponent(MyComp).toThrowError('@Output customEvent not initialized in \'UninitializedOuput\'.');
|
||||
});
|
||||
|
||||
it('should read directives metadata from their binding token', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, PrivateImpl, NeedsPublicApi]});
|
||||
const template = '<div public-api><div needs-public-api></div></div>';
|
||||
|
Reference in New Issue
Block a user