fixup! fix(ivy): incorrectly remapping certain properties that refer to inputs (#28765)

PR Close #28765
This commit is contained in:
Kristiyan Kostadinov
2019-02-21 00:00:02 +01:00
committed by Igor Minar
parent 93a7836f7a
commit 32ae84da28
4 changed files with 109 additions and 160 deletions

View File

@ -137,6 +137,48 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles);
expect(result.source).not.toContain('i0.ɵelementProperty');
});
it('should not remap property names whose names do not correspond to their attribute names',
() => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<label [for]="forValue"></label>\`
})
export class MyComponent {
forValue = 'some-input';
}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = `
const $c0$ = [${AttributeMarker.SelectOnly}, "for"];
// ...
function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$i0$.ɵelement(0, "label", _c0);
}
if (rf & 2) {
$i0$.ɵelementProperty(0, "for", $i0$.ɵbind(ctx.forValue));
}
}`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
});
describe('host bindings', () => {