From 317cc922ac8e2a45bc22edecad9baac238b7f3f3 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Tue, 22 Jan 2019 18:18:45 -0800 Subject: [PATCH] test(ivy): turn on passing tests in platform-browser-dynamic (#28307) PR Close #28307 --- .../resource_loader_cache_spec.ts | 22 ++++--- .../test/testing_public_browser_spec.ts | 58 +++++++++---------- 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts index 08fc9e3db5..ead5fa17b2 100644 --- a/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts +++ b/packages/platform-browser-dynamic/test/resource_loader/resource_loader_cache_spec.ts @@ -12,7 +12,6 @@ import {TestBed, async, fakeAsync, tick} from '@angular/core/testing'; import {CachedResourceLoader} from '@angular/platform-browser-dynamic/src/resource_loader/resource_loader_cache'; import {setTemplateCache} from '@angular/platform-browser-dynamic/test/resource_loader/resource_loader_cache_setter'; import {expect} from '@angular/platform-browser/testing/src/matchers'; -import {fixmeIvy} from '@angular/private/testing'; if (isBrowser) { describe('CachedResourceLoader', () => { @@ -54,20 +53,19 @@ if (isBrowser) { .catch((error) => {/** success */}); })); - fixmeIvy('FW-553: TestBed is unaware of async compilation') - .it('should allow fakeAsync Tests to load components with templateUrl synchronously', - fakeAsync(() => { - TestBed.configureTestingModule({declarations: [TestComponent]}); - TestBed.compileComponents(); - tick(); + it('should allow fakeAsync Tests to load components with templateUrl synchronously', + fakeAsync(() => { + TestBed.configureTestingModule({declarations: [TestComponent]}); + TestBed.compileComponents(); + tick(); - const fixture = TestBed.createComponent(TestComponent); + const fixture = TestBed.createComponent(TestComponent); - // This should initialize the fixture. - tick(); + // This should initialize the fixture. + tick(); - expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello'); - })); + expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello'); + })); }); } diff --git a/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts b/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts index 14091e7d79..0c54024787 100644 --- a/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts +++ b/packages/platform-browser-dynamic/test/testing_public_browser_spec.ts @@ -11,7 +11,6 @@ import {Compiler, Component, NgModule} from '@angular/core'; import {TestBed, async, fakeAsync, inject, tick} from '@angular/core/testing'; import {ResourceLoaderImpl} from '@angular/platform-browser-dynamic/src/resource_loader/resource_loader_impl'; -import {fixmeIvy} from '@angular/private/testing'; @@ -116,41 +115,38 @@ if (isBrowser) { const restoreJasmineIt = () => { jasmine.getEnv().it = originalJasmineIt; }; - fixmeIvy('FW-553: TestBed is unaware of async compilation') - .it('should fail when an ResourceLoader fails', done => { - const itPromise = patchJasmineIt(); + it('should fail when an ResourceLoader fails', done => { + const itPromise = patchJasmineIt(); - it('should fail with an error from a promise', async(() => { - TestBed.configureTestingModule({declarations: [BadTemplateUrl]}); - TestBed.compileComponents(); - })); + it('should fail with an error from a promise', async(() => { + TestBed.configureTestingModule({declarations: [BadTemplateUrl]}); + TestBed.compileComponents(); + })); - itPromise.then( - () => { done.fail('Expected test to fail, but it did not'); }, - (err: any) => { - expect(err.message) - .toEqual('Uncaught (in promise): Failed to load non-existent.html'); - done(); - }); - restoreJasmineIt(); - }, 10000); + itPromise.then( + () => { done.fail('Expected test to fail, but it did not'); }, + (err: any) => { + expect(err.message) + .toEqual('Uncaught (in promise): Failed to load non-existent.html'); + done(); + }); + restoreJasmineIt(); + }, 10000); }); describe('TestBed createComponent', function() { - fixmeIvy('FW-553: TestBed is unaware of async compilation') - .it('should allow an external templateUrl', async(() => { - TestBed.configureTestingModule({declarations: [ExternalTemplateComp]}); - TestBed.compileComponents().then(() => { - const componentFixture = TestBed.createComponent(ExternalTemplateComp); - componentFixture.detectChanges(); - expect(componentFixture.nativeElement.textContent) - .toEqual('from external template'); - }); - }), - 10000); // Long timeout here because this test makes an actual ResourceLoader - // request, and - // is slow - // on Edge. + it('should allow an external templateUrl', async(() => { + TestBed.configureTestingModule({declarations: [ExternalTemplateComp]}); + TestBed.compileComponents().then(() => { + const componentFixture = TestBed.createComponent(ExternalTemplateComp); + componentFixture.detectChanges(); + expect(componentFixture.nativeElement.textContent).toEqual('from external template'); + }); + }), + 10000); // Long timeout here because this test makes an actual ResourceLoader + // request, and + // is slow + // on Edge. }); }); }