fix(compiler): avoid generating i18n attributes in plain form (#36422)
Prior to this change, there was a problem while matching template attributes, which mistakenly took i18n attributes (that might be present in attrs array after template ones) into account. This commit updates the logic to avoid template attribute matching logic from entering the i18n section and as a result this also allows generating proper i18n attributes sections instead of keeping these attribute in plain form (with their values) in attribute arrays. PR Close #36422
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {escapeRegExp, splitAtColon, stringify, utf8Encode} from '../src/util';
|
||||
import {escapeRegExp, partitionArray, splitAtColon, stringify, utf8Encode} from '../src/util';
|
||||
|
||||
{
|
||||
describe('util', () => {
|
||||
@ -83,5 +83,21 @@ import {escapeRegExp, splitAtColon, stringify, utf8Encode} from '../src/util';
|
||||
expect(stringify(Object.create(null))).toEqual('object');
|
||||
});
|
||||
});
|
||||
|
||||
describe('partitionArray()', () => {
|
||||
it('should handle empty arrays', () => {
|
||||
expect(partitionArray([], () => true)).toEqual([[], []]);
|
||||
});
|
||||
|
||||
it('should handle arrays with primitive type values', () => {
|
||||
expect(partitionArray([1, 2, 3], (el: number) => el < 2)).toEqual([[1], [2, 3]]);
|
||||
});
|
||||
|
||||
it('should handle arrays of objects', () => {
|
||||
expect(partitionArray([{id: 1}, {id: 2}, {id: 3}], (el: any) => el.id < 2)).toEqual([
|
||||
[{id: 1}], [{id: 2}, {id: 3}]
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user