77 */
88import './init' ;
99
10+ import { ComponentUsingThirdParty } from '../src/comp_using_3rdp' ;
1011import { MainModule } from '../src/module' ;
1112import { CompUsingLibModuleDirectiveAndPipe , CompUsingRootModuleDirectiveAndPipe , SOME_TOKEN , ServiceUsingLibModule , SomeLibModule , SomeService } from '../src/module_fixtures' ;
1213
@@ -15,9 +16,9 @@ import {createComponent, createModule} from './util';
1516describe ( 'NgModule' , ( ) => {
1617 it ( 'should support providers' , ( ) => {
1718 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 ) ;
2122 } ) ;
2223
2324 it ( 'should support entryComponents components' , ( ) => {
@@ -26,7 +27,7 @@ describe('NgModule', () => {
2627 CompUsingRootModuleDirectiveAndPipe ) ;
2728 expect ( cf . componentType ) . toBe ( CompUsingRootModuleDirectiveAndPipe ) ;
2829 const compRef = cf . create ( moduleRef . injector ) ;
29- expect ( compRef . instance instanceof CompUsingRootModuleDirectiveAndPipe ) . toBe ( true ) ;
30+ expect ( compRef . instance instanceof CompUsingRootModuleDirectiveAndPipe ) . toEqual ( true ) ;
3031 } ) ;
3132
3233 it ( 'should support entryComponents via the ANALYZE_FOR_ENTRY_COMPONENTS provider and function providers in components' ,
@@ -42,23 +43,41 @@ describe('NgModule', () => {
4243 ] ) ;
4344 } ) ;
4445
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+
4564 it ( 'should support module directives and pipes' , ( ) => {
4665 const compFixture = createComponent ( CompUsingRootModuleDirectiveAndPipe ) ;
4766 compFixture . detectChanges ( ) ;
4867
4968 const debugElement = compFixture . debugElement ;
50- expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toBe ( 'transformed someValue' ) ;
69+ expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toEqual ( 'transformed someValue' ) ;
5170 } ) ;
5271
5372 it ( 'should support module directives and pipes on lib modules' , ( ) => {
5473 const compFixture = createComponent ( CompUsingLibModuleDirectiveAndPipe ) ;
5574 compFixture . detectChanges ( ) ;
5675
5776 const debugElement = compFixture . debugElement ;
58- expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toBe ( 'transformed someValue' ) ;
77+ expect ( debugElement . children [ 0 ] . properties [ 'title' ] ) . toEqual ( 'transformed someValue' ) ;
5978
60- expect ( debugElement . injector . get ( SomeLibModule ) instanceof SomeLibModule ) . toBe ( true ) ;
79+ expect ( debugElement . injector . get ( SomeLibModule ) instanceof SomeLibModule ) . toEqual ( true ) ;
6180 expect ( debugElement . injector . get ( ServiceUsingLibModule ) instanceof ServiceUsingLibModule )
62- . toBe ( true ) ;
81+ . toEqual ( true ) ;
6382 } ) ;
6483} ) ;
0 commit comments