Skip to content

Commit b9f8ae8

Browse files
committed
feat: enhance angular template parsing to support additional animation attributes - fixes #2
1 parent 1770c1b commit b9f8ae8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

xmlParser.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ describe('XmlParser', () => {
111111
});
112112
it('should parse angular template', () => {
113113
const fragment = `<div someDirective #someRef></div>
114-
<app-radio-group [formControl]="control">
115-
<app-radio-button *ngFor="let item of dialogData.items" [value]="item">
114+
<app-radio-group [formControl]="control" [@myAnimation]="state">
115+
<app-radio-button *ngFor="let item of dialogData.items" [value]="item" [@myAnimationWithoutState]>
116116
{{ displayLabel(item) }}
117117
</app-radio-button>
118118
</app-radio-group>
@@ -126,12 +126,12 @@ describe('XmlParser', () => {
126126
new XmlText('\n '),
127127
new XmlElement(
128128
'app-radio-group',
129-
[new XmlAttribute('[formControl]', 'control')],
129+
[new XmlAttribute('[formControl]', 'control'), new XmlAttribute('[@myAnimation]', 'state')],
130130
[
131131
new XmlText('\n '),
132132
new XmlElement(
133133
'app-radio-button',
134-
[new XmlAttribute('*ngFor', 'let item of dialogData.items'), new XmlAttribute('[value]', 'item')],
134+
[new XmlAttribute('*ngFor', 'let item of dialogData.items'), new XmlAttribute('[value]', 'item'), new XmlAttribute('[@myAnimationWithoutState]', '', ' ', '', '', '"', false)],
135135
[new XmlText('\n {{ displayLabel(item) }}\n ')],
136136
'',
137137
false,

xmlParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export class XmlParser {
231231
// Reads a name (letters, digits, underscore, hyphen, colon, period).
232232
readName(): string {
233233
const start = this.pos;
234-
while (this.pos < this.input.length && /[A-Za-z0-9_\-.:\[\]*()#]/.test(this.input[this.pos])) {
234+
while (this.pos < this.input.length && /[A-Za-z0-9_\-.:\[\]*()#@]/.test(this.input[this.pos])) {
235235
this.pos++;
236236
}
237237
return this.input.substring(start, this.pos);

0 commit comments

Comments
 (0)