diff --git a/packages/platform-server/test/BUILD.bazel b/packages/platform-server/test/BUILD.bazel index b5ef13e2f9..145ce77f0e 100644 --- a/packages/platform-server/test/BUILD.bazel +++ b/packages/platform-server/test/BUILD.bazel @@ -17,6 +17,7 @@ ts_library( "//packages/http/testing", "//packages/platform-browser", "//packages/platform-server", + "//packages/private/testing", "@rxjs", "@rxjs//operators", ], @@ -26,7 +27,6 @@ jasmine_node_test( name = "test", bootstrap = ["angular/tools/testing/init_node_spec.js"], tags = [ - "fixme-ivy-aot", ], deps = [ ":test_lib", diff --git a/packages/platform-server/test/integration_spec.ts b/packages/platform-server/test/integration_spec.ts index e7720c4367..72e921fabb 100644 --- a/packages/platform-server/test/integration_spec.ts +++ b/packages/platform-server/test/integration_spec.ts @@ -7,16 +7,17 @@ */ import {AnimationBuilder, animate, state, style, transition, trigger} from '@angular/animations'; -import {APP_BASE_HREF, PlatformLocation, isPlatformServer} from '@angular/common'; +import {PlatformLocation, isPlatformServer} from '@angular/common'; import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {ApplicationRef, CompilerFactory, Component, HostListener, Inject, Injectable, Input, NgModule, NgModuleRef, NgZone, PLATFORM_ID, PlatformRef, ViewEncapsulation, destroyPlatform, getPlatform} from '@angular/core'; -import {TestBed, async, inject} from '@angular/core/testing'; +import {async, inject} from '@angular/core/testing'; import {Http, HttpModule, Response, ResponseOptions, XHRBackend} from '@angular/http'; import {MockBackend, MockConnection} from '@angular/http/testing'; -import {BrowserModule, DOCUMENT, StateKey, Title, TransferState, makeStateKey} from '@angular/platform-browser'; +import {BrowserModule, DOCUMENT, Title, TransferState, makeStateKey} from '@angular/platform-browser'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, platformDynamicServer, renderModule, renderModuleFactory} from '@angular/platform-server'; +import {fixmeIvy} from '@angular/private/testing'; import {Observable} from 'rxjs'; import {first} from 'rxjs/operators'; @@ -432,20 +433,21 @@ class HiddenModule { }); })); - it('adds styles with ng-transition attribute', async(() => { - const platform = platformDynamicServer([{ - provide: INITIAL_CONFIG, - useValue: {document: ''} - }]); - platform.bootstrapModule(ExampleStylesModule).then(ref => { - const doc = ref.injector.get(DOCUMENT); - const head = getDOM().getElementsByTagName(doc, 'head')[0]; - const styles: any[] = head.children as any; - expect(styles.length).toBe(1); - expect(getDOM().getText(styles[0])).toContain('color: red'); - expect(getDOM().getAttribute(styles[0], 'ng-transition')).toBe('example-styles'); - }); - })); + fixmeIvy('no deduplication of imported modules') && + it('adds styles with ng-transition attribute', async(() => { + const platform = platformDynamicServer([{ + provide: INITIAL_CONFIG, + useValue: {document: ''} + }]); + platform.bootstrapModule(ExampleStylesModule).then(ref => { + const doc = ref.injector.get(DOCUMENT); + const head = getDOM().getElementsByTagName(doc, 'head')[0]; + const styles: any[] = head.children as any; + expect(styles.length).toBe(1); + expect(getDOM().getText(styles[0])).toContain('color: red'); + expect(getDOM().getAttribute(styles[0], 'ng-transition')).toBe('example-styles'); + }); + })); it('copies known properties to attributes', async(() => { const platform = platformDynamicServer( @@ -538,29 +540,32 @@ class HiddenModule { }); afterEach(() => { expect(called).toBe(true); }); - it('using long form should work', async(() => { - const platform = - platformDynamicServer([{provide: INITIAL_CONFIG, useValue: {document: doc}}]); + fixmeIvy('to investigate') && + it('using long form should work', async(() => { + const platform = + platformDynamicServer([{provide: INITIAL_CONFIG, useValue: {document: doc}}]); - platform.bootstrapModule(AsyncServerModule) - .then((moduleRef) => { - const applicationRef: ApplicationRef = moduleRef.injector.get(ApplicationRef); - return applicationRef.isStable.pipe(first((isStable: boolean) => isStable)) - .toPromise(); - }) - .then((b) => { - expect(platform.injector.get(PlatformState).renderToString()).toBe(expectedOutput); - platform.destroy(); + platform.bootstrapModule(AsyncServerModule) + .then((moduleRef) => { + const applicationRef: ApplicationRef = moduleRef.injector.get(ApplicationRef); + return applicationRef.isStable.pipe(first((isStable: boolean) => isStable)) + .toPromise(); + }) + .then((b) => { + expect(platform.injector.get(PlatformState).renderToString()) + .toBe(expectedOutput); + platform.destroy(); + called = true; + }); + })); + + fixmeIvy('to investigate') && + it('using renderModule should work', async(() => { + renderModule(AsyncServerModule, {document: doc}).then(output => { + expect(output).toBe(expectedOutput); called = true; }); - })); - - it('using renderModule should work', async(() => { - renderModule(AsyncServerModule, {document: doc}).then(output => { - expect(output).toBe(expectedOutput); - called = true; - }); - })); + })); it('using renderModuleFactory should work', async(inject([PlatformRef], (defaultPlatform: PlatformRef) => { @@ -574,25 +579,27 @@ class HiddenModule { }); }))); - it('works with SVG elements', async(() => { - renderModule(SVGServerModule, {document: doc}).then(output => { - expect(output).toBe( - '' + - ''); - called = true; - }); - })); + fixmeIvy('to investigate') && + it('works with SVG elements', async(() => { + renderModule(SVGServerModule, {document: doc}).then(output => { + expect(output).toBe( + '' + + ''); + called = true; + }); + })); - it('works with animation', async(() => { - renderModule(AnimationServerModule, {document: doc}).then(output => { - expect(output).toContain('Works!'); - expect(output).toContain('ng-trigger-myAnimation'); - expect(output).toContain('opacity:1;'); - expect(output).toContain('transform:translate3d(0 , 0 , 0);'); - expect(output).toContain('font-weight:bold;'); - called = true; - }); - })); + fixmeIvy('to investigate') && + it('works with animation', async(() => { + renderModule(AnimationServerModule, {document: doc}).then(output => { + expect(output).toContain('Works!'); + expect(output).toContain('ng-trigger-myAnimation'); + expect(output).toContain('opacity:1;'); + expect(output).toContain('transform:translate3d(0 , 0 , 0);'); + expect(output).toContain('font-weight:bold;'); + called = true; + }); + })); it('should handle ViewEncapsulation.Native', async(() => { renderModule(NativeExampleModule, {document: doc}).then(output => { @@ -603,75 +610,82 @@ class HiddenModule { })); - it('sets a prefix for the _nghost and _ngcontent attributes', async(() => { - renderModule(ExampleStylesModule, {document: doc}).then(output => { - expect(output).toMatch( - /