7
7
*/
8
8
import './init' ;
9
9
10
+ import { ComponentUsingThirdParty } from '../src/comp_using_3rdp' ;
10
11
import { MainModule } from '../src/module' ;
11
12
import { CompUsingLibModuleDirectiveAndPipe , CompUsingRootModuleDirectiveAndPipe , SOME_TOKEN , ServiceUsingLibModule , SomeLibModule , SomeService } from '../src/module_fixtures' ;
12
13
@@ -15,9 +16,9 @@ import {createComponent, createModule} from './util';
15
16
describe ( 'NgModule' , ( ) => {
16
17
it ( 'should support providers' , ( ) => {
17
18
const moduleRef = createModule ( ) ;
18
- expect ( moduleRef . instance instanceof MainModule ) . toBe ( true ) ;
19
- expect ( moduleRef . injector . get ( MainModule ) instanceof MainModule ) . toBe ( true ) ;
20
- expect ( moduleRef . injector . get ( SomeService ) instanceof SomeService ) . toBe ( true ) ;
19
+ expect ( moduleRef . instance instanceof MainModule ) . toEqual ( true ) ;
20
+ expect ( moduleRef . injector . get ( MainModule ) instanceof MainModule ) . toEqual ( true ) ;
21
+ expect ( moduleRef . injector . get ( SomeService ) instanceof SomeService ) . toEqual ( true ) ;
21
22
} ) ;
22
23
23
24
it ( 'should support entryComponents components' , ( ) => {
@@ -26,7 +27,7 @@ describe('NgModule', () => {
26
27
CompUsingRootModuleDirectiveAndPipe ) ;
27
28
expect ( cf . componentType ) . toBe ( CompUsingRootModuleDirectiveAndPipe ) ;
28
29
const compRef = cf . create ( moduleRef . injector ) ;
29
- expect ( compRef . instance instanceof CompUsingRootModuleDirectiveAndPipe ) . toBe ( true ) ;
30
+ expect ( compRef . instance instanceof CompUsingRootModuleDirectiveAndPipe ) . toEqual ( true ) ;
30
31
} ) ;
31
32
32
33
it ( 'should support entryComponents via the ANALYZE_FOR_ENTRY_COMPONENTS provider and function providers in components' ,
@@ -42,23 +43,41 @@ describe('NgModule', () => {
42
43
] ) ;
43
44
} ) ;
44
45
46
+ describe ( 'third-party modules' , ( ) => {
47
+ // https://github.com/angular/angular/issues/11889
48
+ it ( 'should support third party entryComponents components' , ( ) => {
49
+ const fixture = createComponent ( ComponentUsingThirdParty ) ;
50
+ const thirdPComps = fixture . nativeElement . children ;
51
+ expect ( thirdPComps [ 0 ] . children [ 0 ] . children [ 0 ] . data ) . toEqual ( '3rdP-component' ) ;
52
+ expect ( thirdPComps [ 1 ] . children [ 0 ] . children [ 0 ] . data ) . toEqual ( 'other-3rdP-component' ) ;
53
+ } ) ;
54
+
55
+ // https://github.com/angular/angular/issues/12428
56
+ it ( 'should support third party directives' , ( ) => {
57
+ const fixture = createComponent ( ComponentUsingThirdParty ) ;
58
+ const debugElement = fixture . debugElement ;
59
+ fixture . detectChanges ( ) ;
60
+ expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toEqual ( 'from 3rd party' ) ;
61
+ } ) ;
62
+ } ) ;
63
+
45
64
it ( 'should support module directives and pipes' , ( ) => {
46
65
const compFixture = createComponent ( CompUsingRootModuleDirectiveAndPipe ) ;
47
66
compFixture . detectChanges ( ) ;
48
67
49
68
const debugElement = compFixture . debugElement ;
50
- expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toBe ( 'transformed someValue' ) ;
69
+ expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toEqual ( 'transformed someValue' ) ;
51
70
} ) ;
52
71
53
72
it ( 'should support module directives and pipes on lib modules' , ( ) => {
54
73
const compFixture = createComponent ( CompUsingLibModuleDirectiveAndPipe ) ;
55
74
compFixture . detectChanges ( ) ;
56
75
57
76
const debugElement = compFixture . debugElement ;
58
- expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toBe ( 'transformed someValue' ) ;
77
+ expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toEqual ( 'transformed someValue' ) ;
59
78
60
- expect ( debugElement . injector . get ( SomeLibModule ) instanceof SomeLibModule ) . toBe ( true ) ;
79
+ expect ( debugElement . injector . get ( SomeLibModule ) instanceof SomeLibModule ) . toEqual ( true ) ;
61
80
expect ( debugElement . injector . get ( ServiceUsingLibModule ) instanceof ServiceUsingLibModule )
62
- . toBe ( true ) ;
81
+ . toEqual ( true ) ;
63
82
} ) ;
64
83
} ) ;
0 commit comments