refactor(ProtoViewBuilder): improve error message for dangling bindings

Closes #3066
This commit is contained in:
Pawel Kozlowski 2015-07-15 14:52:41 +02:00 committed by Tobias Bosch
parent fc8f4688c7
commit b785503543
3 changed files with 4 additions and 4 deletions

View File

@ -322,7 +322,7 @@ function buildElementPropertyBindings(protoElement: /*element*/ any, isNgCompone
propertyBindings.push(propertyBinding); propertyBindings.push(propertyBinding);
} else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) { } else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) {
throw new BaseException( throw new BaseException(
`Can't bind to '${propertyNameInTemplate}' since it isn't a know property of the '${DOM.tagName(protoElement).toLowerCase()}' element and there are no matching directives with a corresponding property`); `Can't bind to '${propertyNameInTemplate}' since it isn't a known property of the '<${DOM.tagName(protoElement).toLowerCase()}>' element and there are no matching directives with a corresponding property`);
} }
}); });
return propertyBindings; return propertyBindings;

View File

@ -1283,7 +1283,7 @@ export function main() {
PromiseWrapper.catchError(tcb.createAsync(MyComp), (e) => { PromiseWrapper.catchError(tcb.createAsync(MyComp), (e) => {
expect(e.message).toEqual( expect(e.message).toEqual(
`Can't bind to 'unknown' 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 'unknown' since it isn't a known property of the '<div>' element and there are no matching directives with a corresponding property`);
async.done(); async.done();
return null; return null;
}); });

View File

@ -31,7 +31,7 @@ export function main() {
builder.bindElement(el('<div/>')).bindProperty('unknownProperty', emptyExpr()); builder.bindElement(el('<div/>')).bindProperty('unknownProperty', emptyExpr());
expect(() => builder.build()) expect(() => builder.build())
.toThrowError( .toThrowError(
`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 known property of the '<div>' element and there are no matching directives with a corresponding property`);
}); });
it('should allow unknown properties if a directive uses it', () => { it('should allow unknown properties if a directive uses it', () => {
@ -53,7 +53,7 @@ export function main() {
binder.setComponentId('someComponent'); binder.setComponentId('someComponent');
expect(() => builder.build()) expect(() => builder.build())
.toThrowError( .toThrowError(
`Can't bind to 'unknownProperty' since it isn't a know property of the 'some-custom' element and there are no matching directives with a corresponding property`); `Can't bind to 'unknownProperty' since it isn't a known property of the '<some-custom>' element and there are no matching directives with a corresponding property`);
}); });
}); });