|
8 | 8 |
|
9 | 9 | import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core'; |
10 | 10 | import * as $r3$ from '../../../src/core_render3_private_export'; |
| 11 | +import {ComponentDef} from '../../../src/render3/interfaces/definition'; |
11 | 12 | import {renderComponent, toHtml} from '../render_util'; |
12 | 13 |
|
| 14 | + |
| 15 | + |
13 | 16 | /// See: `normative.md` |
14 | 17 | describe('components & directives', () => { |
15 | 18 | type $RenderFlags$ = $r3$.ɵRenderFlags; |
@@ -76,8 +79,8 @@ describe('components & directives', () => { |
76 | 79 | } |
77 | 80 |
|
78 | 81 | // NON-NORMATIVE (done by defineNgModule) |
79 | | - MyComponent.ngComponentDef.directiveDefs = |
80 | | - [ChildComponent.ngComponentDef, SomeDirective.ngDirectiveDef]; |
| 82 | + (MyComponent.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 83 | + [(ChildComponent.ngComponentDef as ComponentDef<any>), SomeDirective.ngDirectiveDef]; |
81 | 84 | // /NON-NORMATIVE |
82 | 85 |
|
83 | 86 | expect(renderComp(MyComponent)).toEqual('<child some-directive="">child-view</child>!'); |
@@ -126,7 +129,7 @@ describe('components & directives', () => { |
126 | 129 | } |
127 | 130 |
|
128 | 131 | // NON-NORMATIVE (done by defineNgModule) |
129 | | - MyApp.ngComponentDef.directiveDefs = [HostBindingDir.ngDirectiveDef]; |
| 132 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = [HostBindingDir.ngDirectiveDef]; |
130 | 133 | // /NON-NORMATIVE |
131 | 134 |
|
132 | 135 | expect(renderComp(MyApp)).toEqual(`<div hostbindingdir="" id="some id"></div>`); |
@@ -177,7 +180,7 @@ describe('components & directives', () => { |
177 | 180 | } |
178 | 181 |
|
179 | 182 | // NON-NORMATIVE (done by defineNgModule) |
180 | | - MyApp.ngComponentDef.directiveDefs = [HostListenerDir.ngDirectiveDef]; |
| 183 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = [HostListenerDir.ngDirectiveDef]; |
181 | 184 | // /NON-NORMATIVE |
182 | 185 |
|
183 | 186 | expect(renderComp(MyApp)).toEqual(`<button hostlistenerdir="">Click</button>`); |
@@ -222,7 +225,7 @@ describe('components & directives', () => { |
222 | 225 | } |
223 | 226 |
|
224 | 227 | // NON-NORMATIVE (done by defineNgModule) |
225 | | - MyApp.ngComponentDef.directiveDefs = [HostAttributeDir.ngDirectiveDef]; |
| 228 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = [HostAttributeDir.ngDirectiveDef]; |
226 | 229 | // /NON-NORMATIVE |
227 | 230 |
|
228 | 231 | expect(renderComp(MyApp)).toEqual(`<div hostattributedir="" role="listbox"></div>`); |
@@ -270,7 +273,7 @@ describe('components & directives', () => { |
270 | 273 | } |
271 | 274 |
|
272 | 275 | // NON-NORMATIVE (done by defineNgModule) |
273 | | - MyApp.ngComponentDef.directiveDefs = [HostBindingDir.ngDirectiveDef]; |
| 276 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = [HostBindingDir.ngDirectiveDef]; |
274 | 277 | // /NON-NORMATIVE |
275 | 278 |
|
276 | 279 | expect(renderComp(MyApp)).toEqual(`<div aria-label="some label" hostbindingdir=""></div>`); |
@@ -333,7 +336,8 @@ describe('components & directives', () => { |
333 | 336 | } |
334 | 337 |
|
335 | 338 | // NON-NORMATIVE (done by defineNgModule) |
336 | | - MyApp.ngComponentDef.directiveDefs = [MyComp.ngComponentDef]; |
| 339 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 340 | + [(MyComp.ngComponentDef as ComponentDef<any>)]; |
337 | 341 | // /NON-NORMATIVE |
338 | 342 |
|
339 | 343 | expect(renderComp(MyApp)).toEqual(`<my-comp>some name</my-comp>`); |
@@ -463,7 +467,8 @@ describe('components & directives', () => { |
463 | 467 | } |
464 | 468 |
|
465 | 469 | // NON-NORMATIVE (done by defineNgModule) |
466 | | - MyApp.ngComponentDef.directiveDefs = [MyArrayComp.ngComponentDef]; |
| 470 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 471 | + [(MyArrayComp.ngComponentDef as ComponentDef<any>)]; |
467 | 472 | // /NON-NORMATIVE |
468 | 473 |
|
469 | 474 | expect(renderComp(MyApp)).toEqual(`<my-array-comp>Nancy Bess</my-array-comp>`); |
@@ -507,7 +512,8 @@ describe('components & directives', () => { |
507 | 512 | } |
508 | 513 |
|
509 | 514 | // NON-NORMATIVE (done by defineNgModule) |
510 | | - MyApp.ngComponentDef.directiveDefs = [MyArrayComp.ngComponentDef]; |
| 515 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 516 | + [(MyArrayComp.ngComponentDef as ComponentDef<any>)]; |
511 | 517 | // /NON-NORMATIVE |
512 | 518 |
|
513 | 519 | expect(renderComp(MyApp)).toEqual(`<my-array-comp>NANCY Bess</my-array-comp>`); |
@@ -567,7 +573,8 @@ describe('components & directives', () => { |
567 | 573 | } |
568 | 574 |
|
569 | 575 | // NON-NORMATIVE (done by defineNgModule) |
570 | | - MyApp.ngComponentDef.directiveDefs = [MyComp.ngComponentDef]; |
| 576 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 577 | + [(MyComp.ngComponentDef as ComponentDef<any>)]; |
571 | 578 | // /NON-NORMATIVE |
572 | 579 |
|
573 | 580 | expect(renderComp(MyApp)).toEqual(`<my-comp>3</my-comp>`); |
@@ -609,7 +616,8 @@ describe('components & directives', () => { |
609 | 616 | } |
610 | 617 |
|
611 | 618 | // NON-NORMATIVE (done by defineNgModule) |
612 | | - MyApp.ngComponentDef.directiveDefs = [MyArrayComp.ngComponentDef]; |
| 619 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 620 | + [(MyArrayComp.ngComponentDef as ComponentDef<any>)]; |
613 | 621 | // /NON-NORMATIVE |
614 | 622 |
|
615 | 623 | expect(renderComp(MyApp)).toEqual(`<my-array-comp>Nancy Bess</my-array-comp>`); |
@@ -721,7 +729,8 @@ describe('components & directives', () => { |
721 | 729 | } |
722 | 730 |
|
723 | 731 | // NON-NORMATIVE (done by defineNgModule) |
724 | | - MyApp.ngComponentDef.directiveDefs = [MyComp.ngComponentDef]; |
| 732 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 733 | + [(MyComp.ngComponentDef as ComponentDef<any>)]; |
725 | 734 | // /NON-NORMATIVE |
726 | 735 |
|
727 | 736 | expect(renderComp(MyApp)).toEqual(`<my-comp>start-abcde-middle-fghi-end</my-comp>`); |
@@ -795,7 +804,8 @@ describe('components & directives', () => { |
795 | 804 | } |
796 | 805 |
|
797 | 806 | // NON-NORMATIVE (done by defineNgModule) |
798 | | - MyApp.ngComponentDef.directiveDefs = [ObjectComp.ngComponentDef]; |
| 807 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 808 | + [(ObjectComp.ngComponentDef as ComponentDef<any>)]; |
799 | 809 | // /NON-NORMATIVE |
800 | 810 |
|
801 | 811 | expect(renderComp(MyApp)).toEqual(`<object-comp><p>500</p><p>slide</p></object-comp>`); |
@@ -882,7 +892,8 @@ describe('components & directives', () => { |
882 | 892 | } |
883 | 893 |
|
884 | 894 | // NON-NORMATIVE (done by defineNgModule) |
885 | | - MyApp.ngComponentDef.directiveDefs = [NestedComp.ngComponentDef]; |
| 895 | + (MyApp.ngComponentDef as ComponentDef<any>).directiveDefs = |
| 896 | + [(NestedComp.ngComponentDef as ComponentDef<any>)]; |
886 | 897 | // /NON-NORMATIVE |
887 | 898 |
|
888 | 899 | expect(renderComp(MyApp)) |
|
0 commit comments