fix(platform-server): handle innerText (#15818)

This commit is contained in:
Adrien Boullé 2017-04-13 20:54:57 +02:00 committed by Tobias Bosch
parent 70b1d6dd9d
commit 9394835db4
2 changed files with 9 additions and 3 deletions

View File

@ -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 {

View File

@ -54,15 +54,19 @@ class TitleApp {
class TitleAppModule {
}
@Component({selector: 'app', template: '{{text}}'})
@Component({selector: 'app', template: '{{text}}<h1 [innerText]="h1"></h1>'})
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 =
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">Works!</app></body></html>';
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">Works!<h1 innerText="fine">fine</h1></app></body></html>';
beforeEach(() => {
// PlatformConfig takes in a parsed document so that it can be cached across requests.