From 9394835db46b6adb797addf563d48fd139e2a32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Boull=C3=A9?= Date: Thu, 13 Apr 2017 20:54:57 +0200 Subject: [PATCH] fix(platform-server): handle innerText (#15818) --- packages/platform-server/src/parse5_adapter.ts | 2 ++ packages/platform-server/test/integration_spec.ts | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/platform-server/src/parse5_adapter.ts b/packages/platform-server/src/parse5_adapter.ts index 9e76abd5ae..baf4ce6160 100644 --- a/packages/platform-server/src/parse5_adapter.ts +++ b/packages/platform-server/src/parse5_adapter.ts @@ -80,6 +80,8 @@ export class Parse5DomAdapter extends DomAdapter { setProperty(el: any, name: string, value: any) { if (name === 'innerHTML') { this.setInnerHTML(el, value); + } else if (name === 'innerText') { + this.setText(el, value); } else if (name === 'className') { el.attribs['class'] = el.className = value; } else { diff --git a/packages/platform-server/test/integration_spec.ts b/packages/platform-server/test/integration_spec.ts index deb3964aa1..920f221ffd 100644 --- a/packages/platform-server/test/integration_spec.ts +++ b/packages/platform-server/test/integration_spec.ts @@ -54,15 +54,19 @@ class TitleApp { class TitleAppModule { } -@Component({selector: 'app', template: '{{text}}'}) +@Component({selector: 'app', template: '{{text}}

'}) class MyAsyncServerApp { text = ''; + h1 = ''; @HostListener('window:scroll') track() { console.error('scroll'); } ngOnInit() { - Promise.resolve(null).then(() => setTimeout(() => { this.text = 'Works!'; }, 10)); + Promise.resolve(null).then(() => setTimeout(() => { + this.text = 'Works!'; + this.h1 = 'fine'; + }, 10)); } } @@ -353,7 +357,7 @@ export function main() { let doc: string; let called: boolean; let expectedOutput = - 'Works!'; + 'Works!

fine

'; beforeEach(() => { // PlatformConfig takes in a parsed document so that it can be cached across requests.