fix(test): add a test for @PropertySetter on a class with a dash

Closes #1113
Fixes #1099
This commit is contained in:
Marc Laval 2015-03-26 10:59:52 +01:00 committed by Pawel Kozlowski
parent b46d0bc48c
commit d822793229
1 changed files with 6 additions and 2 deletions

View File

@ -79,14 +79,16 @@ class NeedsPropertySetter {
propSetter; propSetter;
roleSetter; roleSetter;
classSetter; classSetter;
classWithDashSetter;
styleSetter; styleSetter;
unitSetter; unitSetter;
constructor(@PropertySetter('title') propSetter: Function, @PropertySetter('attr.role') roleSetter: Function, constructor(@PropertySetter('title') propSetter: Function, @PropertySetter('attr.role') roleSetter: Function,
@PropertySetter('class.active') classSetter: Function, @PropertySetter('style.width') styleSetter: Function, @PropertySetter('class.active') classSetter: Function, @PropertySetter('class.foo-bar') classWithDashSetter: Function,
@PropertySetter('style.height.px') unitSetter: Function) { @PropertySetter('style.width') styleSetter: Function, @PropertySetter('style.height.px') unitSetter: Function) {
this.propSetter = propSetter; this.propSetter = propSetter;
this.roleSetter = roleSetter; this.roleSetter = roleSetter;
this.classSetter = classSetter; this.classSetter = classSetter;
this.classWithDashSetter = classWithDashSetter;
this.styleSetter = styleSetter; this.styleSetter = styleSetter;
this.unitSetter = unitSetter; this.unitSetter = unitSetter;
} }
@ -568,12 +570,14 @@ export function main() {
component.setProp('foobar'); component.setProp('foobar');
component.setRole('button'); component.setRole('button');
component.setClass(true); component.setClass(true);
component.classWithDashSetter(true);
component.setStyle('40px') component.setStyle('40px')
component.setStyleWithUnit(50); component.setStyleWithUnit(50);
expect(div.title).toEqual('foobar'); expect(div.title).toEqual('foobar');
expect(DOM.getAttribute(div, 'role')).toEqual('button'); expect(DOM.getAttribute(div, 'role')).toEqual('button');
expect(DOM.hasClass(div, 'active')).toEqual(true); expect(DOM.hasClass(div, 'active')).toEqual(true);
expect(DOM.hasClass(div, 'foo-bar')).toEqual(true);
expect(DOM.getStyle(div, 'width')).toEqual('40px'); expect(DOM.getStyle(div, 'width')).toEqual('40px');
expect(DOM.getStyle(div, 'height')).toEqual('50px'); expect(DOM.getStyle(div, 'height')).toEqual('50px');
}); });