test(ProtoViewBuilder): correct duplicate tests

Closes #2860
This commit is contained in:
Pawel Kozlowski 2015-07-03 14:01:49 +02:00
parent 19a0349681
commit 582551bea9

View File

@ -31,21 +31,20 @@ export function main() {
`Can't bind to 'unknownProperty' since it isn't a know property of the 'div' element and there are no matching directives with a corresponding property`); `Can't bind to 'unknownProperty' since it isn't a know property of the 'div' element and there are no matching directives with a corresponding property`);
}); });
it('should should allow unknown properties if a directive uses it', () => { it('should allow unknown properties if a directive uses it', () => {
builder.bindElement(el('<div/>')).bindProperty('unknownProperty', emptyExpr()); var binder = builder.bindElement(el('<div/>'));
expect(() => builder.build()) binder.bindDirective(0).bindProperty('someDirProperty', emptyExpr(), 'directiveProperty');
.toThrowError( binder.bindProperty('directiveProperty', emptyExpr());
`Can't bind to 'unknownProperty' since it isn't a know property of the 'div' element and there are no matching directives with a corresponding property`); expect(() => builder.build()).not.toThrow();
}); });
it('should allow unknown properties on custom elements', () => { it('should allow unknown properties on custom elements', () => {
var binder = builder.bindElement(el('<some-custom/>')); var binder = builder.bindElement(el('<some-custom/>'));
binder.bindProperty('unknownProperty', emptyExpr()); binder.bindProperty('unknownProperty', emptyExpr());
binder.bindDirective(0).bindProperty('someDirProperty', emptyExpr(), 'unknownProperty');
expect(() => builder.build()).not.toThrow(); expect(() => builder.build()).not.toThrow();
}); });
it('should throw for unkown properties on custom elements if there is an ng component', () => { it('should throw for unknown properties on custom elements if there is an ng component', () => {
var binder = builder.bindElement(el('<some-custom/>')); var binder = builder.bindElement(el('<some-custom/>'));
binder.bindProperty('unknownProperty', emptyExpr()); binder.bindProperty('unknownProperty', emptyExpr());
binder.setComponentId('someComponent'); binder.setComponentId('someComponent');