feat(ivy): improve ExpressionChangedAfterChecked
error message for attributes (#34505)
This commit improves `ExpressionChangedAfterChecked` error message for attributes by including attribute name and the content of the entire expression that contains interpolation(s). In order to achieve that, metadata is now stored in `TData` array when `attribute` and `attributeInterpolate` instructions are being called (similar to `property` and `propertyInterpolate` instructions). PR Close #34505
This commit is contained in:
@ -1301,17 +1301,16 @@ describe('change detection', () => {
|
||||
});
|
||||
|
||||
it('should include field name in case of attribute binding', () => {
|
||||
// TODO(akushnir): improve error message and include attr name in Ivy
|
||||
const message = ivyEnabled ? `Previous value: 'initial'. Current value: 'changed'` :
|
||||
`Previous value: 'id: initial'. Current value: 'id: changed'`;
|
||||
const message = ivyEnabled ?
|
||||
`Previous value for 'attr.id': 'initial'. Current value: 'changed'` :
|
||||
`Previous value: 'id: initial'. Current value: 'id: changed'`;
|
||||
expect(() => initWithTemplate('<div [attr.id]="unstableStringExpression"></div>'))
|
||||
.toThrowError(new RegExp(message));
|
||||
});
|
||||
|
||||
it('should include field name in case of attribute interpolation', () => {
|
||||
// TODO(akushnir): improve error message and include attr name and entire expression in Ivy
|
||||
const message = ivyEnabled ?
|
||||
`Previous value: 'initial'. Current value: 'changed'` :
|
||||
`Previous value for 'attr.id': 'Expressions: a and initial!'. Current value: 'Expressions: a and changed!'` :
|
||||
`Previous value: 'id: Expressions: a and initial!'. Current value: 'id: Expressions: a and changed!'`;
|
||||
expect(
|
||||
() => initWithTemplate(
|
||||
|
Reference in New Issue
Block a user