From 04cf4ef0c7985c6d1df7e203cfbef34d52402e3d Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Mon, 4 Mar 2019 14:59:52 +0100 Subject: [PATCH] test(ivy): remove ngComponentOutlet example with a lazy-loaded NgModule (#29094) PR Close #29094 --- .../src/directives/ng_component_outlet.ts | 4 -- .../ts/e2e_test/ngComponentOutlet_spec.ts | 45 ++++++--------- .../common/ngComponentOutlet/ts/module.ts | 55 ++----------------- 3 files changed, 23 insertions(+), 81 deletions(-) diff --git a/packages/common/src/directives/ng_component_outlet.ts b/packages/common/src/directives/ng_component_outlet.ts index 5a7141b70f..23f2b856a4 100644 --- a/packages/common/src/directives/ng_component_outlet.ts +++ b/packages/common/src/directives/ng_component_outlet.ts @@ -60,10 +60,6 @@ import {ComponentFactoryResolver, ComponentRef, Directive, Injector, Input, NgMo * A more complete example with additional options: * * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} - - * A more complete example with ngModuleFactory: - * - * {@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} * * @publicApi * @ngModule CommonModule diff --git a/packages/examples/common/ngComponentOutlet/ts/e2e_test/ngComponentOutlet_spec.ts b/packages/examples/common/ngComponentOutlet/ts/e2e_test/ngComponentOutlet_spec.ts index f04cd582b2..6dd03cfed8 100644 --- a/packages/examples/common/ngComponentOutlet/ts/e2e_test/ngComponentOutlet_spec.ts +++ b/packages/examples/common/ngComponentOutlet/ts/e2e_test/ngComponentOutlet_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {fixmeIvy, modifiedInIvy} from '@angular/private/testing'; +import {modifiedInIvy} from '@angular/private/testing'; import {$, ExpectedConditions, browser, by, element} from 'protractor'; import {verifyNoBrowserErrors} from '../../../../test-utils'; @@ -17,33 +17,24 @@ function waitForElement(selector: string) { browser.wait(EC.presenceOf($(selector)), 20000); } -fixmeIvy('FW-1022: JitCompilerFactory creates incorrect compiler instance') - .describe('ngComponentOutlet', () => { - const URL = '/ngComponentOutlet'; - afterEach(verifyNoBrowserErrors); +describe('ngComponentOutlet', () => { + const URL = '/ngComponentOutlet'; + afterEach(verifyNoBrowserErrors); - describe('ng-component-outlet-example', () => { - it('should render simple', () => { + describe('ng-component-outlet-example', () => { + it('should render simple', () => { + browser.get(URL); + waitForElement('ng-component-outlet-simple-example'); + expect(element.all(by.css('hello-world')).getText()).toEqual(['Hello World!']); + }); + + modifiedInIvy('Different behavior for projectableNodes in ViewContainerRef.createComponent') + .it('should render complete', () => { browser.get(URL); - waitForElement('ng-component-outlet-simple-example'); - expect(element.all(by.css('hello-world')).getText()).toEqual(['Hello World!']); - }); - - modifiedInIvy('Different behavior for projectableNodes in ViewContainerRef.createComponent') - .it('should render complete', () => { - browser.get(URL); - waitForElement('ng-component-outlet-complete-example'); - expect(element.all(by.css('complete-component')).getText()).toEqual([ - 'Complete: AhojSvet!' - ]); - }); - - it('should render other module', () => { - browser.get(URL); - waitForElement('ng-component-outlet-other-module-example'); - expect(element.all(by.css('other-module-component')).getText()).toEqual([ - 'Other Module Component!' + waitForElement('ng-component-outlet-complete-example'); + expect(element.all(by.css('complete-component')).getText()).toEqual([ + 'Complete: AhojSvet!' ]); }); - }); - }); + }); +}); diff --git a/packages/examples/common/ngComponentOutlet/ts/module.ts b/packages/examples/common/ngComponentOutlet/ts/module.ts index a351268186..e395805cfa 100644 --- a/packages/examples/common/ngComponentOutlet/ts/module.ts +++ b/packages/examples/common/ngComponentOutlet/ts/module.ts @@ -6,11 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {CommonModule} from '@angular/common'; -import {COMPILER_OPTIONS, Compiler, CompilerFactory, Component, Injectable, Injector, NgModule, NgModuleFactory} from '@angular/core'; +import {Component, Injectable, Injector, NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; -import {JitCompilerFactory} from '@angular/platform-browser-dynamic'; - // #docregion SimpleExample @@ -63,65 +60,23 @@ export class NgTemplateOutletCompleteExample { } // #enddocregion -// #docregion NgModuleFactoryExample -@Component({selector: 'other-module-component', template: `Other Module Component!`}) -export class OtherModuleComponent { -} - -@Component({ - selector: 'ng-component-outlet-other-module-example', - template: ` - ` -}) -export class NgTemplateOutletOtherModuleExample { - // This field is necessary to expose OtherModuleComponent to the template. - OtherModuleComponent = OtherModuleComponent; - myModule: NgModuleFactory; - - constructor(compiler: Compiler) { this.myModule = compiler.compileModuleSync(OtherModule); } -} -// #enddocregion - @Component({ selector: 'example-app', template: `
- -
- ` + ` }) export class AppComponent { } -@NgModule({ - imports: [CommonModule], - declarations: [OtherModuleComponent], - entryComponents: [OtherModuleComponent] -}) -export class OtherModule { -} - -export function createCompiler(compilerFactory: CompilerFactory) { - return compilerFactory.createCompiler(); -} - @NgModule({ imports: [BrowserModule], declarations: [ - AppComponent, NgTemplateOutletSimpleExample, NgTemplateOutletCompleteExample, - NgTemplateOutletOtherModuleExample, HelloWorld, CompleteComponent + AppComponent, NgTemplateOutletSimpleExample, NgTemplateOutletCompleteExample, HelloWorld, + CompleteComponent ], - entryComponents: [HelloWorld, CompleteComponent], - providers: [ - // Setup the JIT compiler that is not set up by default because the examples - // are bootstrapped using their NgModule factory. Since this example uses the - // JIT compiler, we manually set it up for this module. - {provide: COMPILER_OPTIONS, useValue: {}, multi: true}, - {provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]}, - {provide: Compiler, useFactory: createCompiler, deps: [CompilerFactory]} - ] + entryComponents: [HelloWorld, CompleteComponent] }) export class AppModule { }