fix: properly bind to camelCased properties

Fixes #866
Closes #941
This commit is contained in:
Pawel Kozlowski
2015-03-12 17:28:35 +01:00
parent afda43dc02
commit b39d2c0101
8 changed files with 61 additions and 21 deletions

View File

@ -133,6 +133,23 @@ export function main() {
});
}));
it('should consume binding to camel-cased properties using dash-cased syntax in templates', inject([AsyncTestCompleter], (async) => {
tplResolver.setTemplate(MyComp, new Template({inline: '<input [read-only]="ctxBoolProp">'}));
compiler.compile(MyComp).then((pv) => {
createView(pv);
cd.detectChanges();
expect(view.nodes[0].readOnly).toBeFalsy();
ctx.ctxBoolProp = true;
cd.detectChanges();
expect(view.nodes[0].readOnly).toBeTruthy();
async.done();
});
}));
it('should consume binding to inner-html', inject([AsyncTestCompleter], (async) => {
tplResolver.setTemplate(MyComp, new Template({inline: '<div inner-html="{{ctxProp}}"></div>'}));
@ -592,9 +609,11 @@ class PushBasedComp {
class MyComp {
ctxProp:string;
ctxNumProp;
ctxBoolProp;
constructor() {
this.ctxProp = 'initial value';
this.ctxNumProp = 0;
this.ctxBoolProp = false;
}
}