test(ivy): remove ngComponentOutlet example with a lazy-loaded NgModule (#29094)
PR Close #29094
This commit is contained in:
parent
aa57bdbf90
commit
04cf4ef0c7
|
@ -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
|
||||
|
|
|
@ -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!'
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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: `
|
||||
<ng-container *ngComponentOutlet="OtherModuleComponent;
|
||||
ngModuleFactory: myModule;"></ng-container>`
|
||||
})
|
||||
export class NgTemplateOutletOtherModuleExample {
|
||||
// This field is necessary to expose OtherModuleComponent to the template.
|
||||
OtherModuleComponent = OtherModuleComponent;
|
||||
myModule: NgModuleFactory<any>;
|
||||
|
||||
constructor(compiler: Compiler) { this.myModule = compiler.compileModuleSync(OtherModule); }
|
||||
}
|
||||
// #enddocregion
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'example-app',
|
||||
template: `<ng-component-outlet-simple-example></ng-component-outlet-simple-example>
|
||||
<hr/>
|
||||
<ng-component-outlet-complete-example></ng-component-outlet-complete-example>
|
||||
<hr/>
|
||||
<ng-component-outlet-other-module-example></ng-component-outlet-other-module-example>`
|
||||
<ng-component-outlet-complete-example></ng-component-outlet-complete-example>`
|
||||
})
|
||||
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 {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue