fix(compiler): allow identifiers with -
in the template bindings as keys.
This commit is contained in:
@ -79,8 +79,10 @@ export class ViewSplitter extends CompileStep {
|
||||
var binding = bindings[i];
|
||||
if (isPresent(binding.name)) {
|
||||
compileElement.addVariableBinding(binding.key, binding.name);
|
||||
} else {
|
||||
} else if (isPresent(binding.expression)) {
|
||||
compileElement.addPropertyBinding(binding.key, binding.expression);
|
||||
} else {
|
||||
compileElement.element.setAttribute(binding.key, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,14 @@ export function main() {
|
||||
expect(results[1].variableBindings).toEqual(MapWrapper.createFromStringMap({'varName': 'mapName'}));
|
||||
});
|
||||
|
||||
it('should add entries without value as attribute to the element', () => {
|
||||
var rootElement = createElement('<div><div template="varname"></div></div>');
|
||||
var results = createPipeline().process(rootElement);
|
||||
expect(results[1].attrs()).toEqual(MapWrapper.createFromStringMap({'varname': ''}));
|
||||
expect(results[1].propertyBindings).toBe(null);
|
||||
expect(results[1].variableBindings).toBe(null);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user