(defs: {
app?: ComponentTest;
parent?: ComponentTest;
viewChild?: ComponentTest;
contentChild?: ComponentTest;
ngModule?: Type<any>;
})
| 19 | } |
| 20 | |
| 21 | export function expectProvidersScenario(defs: { |
| 22 | app?: ComponentTest; |
| 23 | parent?: ComponentTest; |
| 24 | viewChild?: ComponentTest; |
| 25 | contentChild?: ComponentTest; |
| 26 | ngModule?: Type<any>; |
| 27 | }): void { |
| 28 | @Component({ |
| 29 | selector: 'view-child', |
| 30 | template: 'view-child', |
| 31 | encapsulation: ViewEncapsulation.None, |
| 32 | providers: defs.viewChild?.providers ?? [], |
| 33 | viewProviders: defs.viewChild?.viewProviders ?? [], |
| 34 | }) |
| 35 | class ViewChildComponent { |
| 36 | constructor() { |
| 37 | defs.viewChild?.componentAssertion?.(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | @Directive({ |
| 42 | selector: 'view-child', |
| 43 | providers: defs.viewChild?.directiveProviders ?? [], |
| 44 | }) |
| 45 | class ViewChildDirective { |
| 46 | constructor() { |
| 47 | defs.viewChild?.directiveAssertion?.(); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | @Component({ |
| 52 | selector: 'content-child', |
| 53 | template: 'content-child', |
| 54 | encapsulation: ViewEncapsulation.None, |
| 55 | providers: defs.contentChild?.providers ?? [], |
| 56 | viewProviders: defs.contentChild?.viewProviders ?? [], |
| 57 | }) |
| 58 | class ContentChildComponent { |
| 59 | constructor() { |
| 60 | defs.contentChild?.componentAssertion?.(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | @Directive({ |
| 65 | selector: 'content-child', |
| 66 | providers: defs.contentChild?.directiveProviders ?? [], |
| 67 | }) |
| 68 | class ContentChildDirective { |
| 69 | constructor() { |
| 70 | defs.contentChild?.directiveAssertion?.(); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | @Component({ |
| 75 | imports: [ViewChildComponent, ViewChildDirective], |
| 76 | selector: 'parent', |
| 77 | template: '<view-child></view-child>', |
| 78 | encapsulation: ViewEncapsulation.None, |
no test coverage detected
searching dependent graphs…