Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(platform-server): handle innerText #15818

Merged
merged 1 commit into from Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/platform-server/src/parse5_adapter.ts
Expand Up @@ -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 {
Expand Down
10 changes: 7 additions & 3 deletions packages/platform-server/test/integration_spec.ts
Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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.
Expand Down