fix(platform-server): don't clobber parse5 properties when setting (#18237)

element properties.

Fixes #17050.

We now store all element properties in a separate 'properties' bag.

PR Close #18237
This commit is contained in:
Vikram Subramanian
2017-07-19 13:58:23 -07:00
committed by Miško Hevery
parent b4c98305da
commit a094769bca
3 changed files with 44 additions and 11 deletions

View File

@ -197,6 +197,20 @@ class MyHostComponent {
class FalseAttributesModule {
}
@Component({selector: 'app', template: '<input [name]="name">'})
class MyInputComponent {
@Input()
name = '';
}
@NgModule({
declarations: [MyInputComponent],
bootstrap: [MyInputComponent],
imports: [ServerModule, BrowserModule.withServerTransition({appId: 'name-attributes'})]
})
class NameModule {
}
export function main() {
if (getDOM().supportsDOMEvents()) return; // NODE only
@ -439,13 +453,22 @@ export function main() {
}));
it('should handle false values on attributes', async(() => {
renderModule(FalseAttributesModule, {document: doc}).then((output) => {
renderModule(FalseAttributesModule, {document: doc}).then(output => {
expect(output).toBe(
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
'<my-child ng-reflect-attr="false">Works!</my-child></app></body></html>');
called = true;
});
}));
it('should handle element property "name"', async(() => {
renderModule(NameModule, {document: doc}).then(output => {
expect(output).toBe(
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
'<input name=""></app></body></html>');
called = true;
});
}));
});
describe('http', () => {