test(ivy): enable all test for @angular/common (#27700)

PR Close #27700
This commit is contained in:
Pawel Kozlowski 2018-12-17 10:56:32 +01:00 committed by Miško Hevery
parent f8096d4993
commit ea10a3abe5
2 changed files with 13 additions and 16 deletions

View File

@ -15,7 +15,6 @@ ts_library(
"//packages/platform-browser", "//packages/platform-browser",
"//packages/platform-browser-dynamic", "//packages/platform-browser-dynamic",
"//packages/platform-browser/testing", "//packages/platform-browser/testing",
"//packages/private/testing",
], ],
) )

View File

@ -11,7 +11,6 @@ import {NgComponentOutlet} from '@angular/common/src/directives/ng_component_out
import {Compiler, Component, ComponentRef, Inject, InjectionToken, Injector, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory, Optional, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core'; import {Compiler, Component, ComponentRef, Inject, InjectionToken, Injector, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory, Optional, QueryList, TemplateRef, Type, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core';
import {TestBed, async} from '@angular/core/testing'; import {TestBed, async} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
describe('insert/remove', () => { describe('insert/remove', () => {
@ -157,22 +156,21 @@ describe('insert/remove', () => {
expect(fixture.nativeElement).toHaveText('baz'); expect(fixture.nativeElement).toHaveText('baz');
})); }));
fixmeIvy('FW-739: destroy on NgModuleRef is not being called') it('should clean up moduleRef, if supplied', async(() => {
.it('should clean up moduleRef, if supplied', async(() => { let destroyed = false;
let destroyed = false; const compiler = TestBed.get(Compiler) as Compiler;
const compiler = TestBed.get(Compiler) as Compiler; const fixture = TestBed.createComponent(TestComponent);
const fixture = TestBed.createComponent(TestComponent); fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2); fixture.componentInstance.currentComponent = Module2InjectedComponent;
fixture.componentInstance.currentComponent = Module2InjectedComponent; fixture.detectChanges();
fixture.detectChanges();
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'] !; const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'] !;
spyOn(moduleRef, 'destroy').and.callThrough(); spyOn(moduleRef, 'destroy').and.callThrough();
expect(moduleRef.destroy).not.toHaveBeenCalled(); expect(moduleRef.destroy).not.toHaveBeenCalled();
fixture.destroy(); fixture.destroy();
expect(moduleRef.destroy).toHaveBeenCalled(); expect(moduleRef.destroy).toHaveBeenCalled();
})); }));
it('should not re-create moduleRef when it didn\'t actually change', async(() => { it('should not re-create moduleRef when it didn\'t actually change', async(() => {
const compiler = TestBed.get(Compiler) as Compiler; const compiler = TestBed.get(Compiler) as Compiler;