fix(angular): handle parens in ng expression correctly (#5387)

master
Ika 2018-11-09 00:06:16 +08:00 committed by GitHub
parent fd8ec95e0a
commit 7f472d72ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 4 deletions

View File

@ -19,7 +19,7 @@
"@babel/parser": "7.1.5", "@babel/parser": "7.1.5",
"@glimmer/syntax": "0.30.3", "@glimmer/syntax": "0.30.3",
"@iarna/toml": "2.0.0", "@iarna/toml": "2.0.0",
"angular-estree-parser": "1.1.3", "angular-estree-parser": "1.1.4",
"angular-html-parser": "1.0.0", "angular-html-parser": "1.0.0",
"camelcase": "4.1.0", "camelcase": "4.1.0",
"chalk": "2.1.0", "chalk": "2.1.0",

View File

@ -81,6 +81,10 @@ exports[`attributes.component.html - angular-verify 1`] = `
[target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }" [target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }"
[error]="'We couldn\\\\\\'t find anything with that name.'" [error]="'We couldn\\\\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="
{'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER}"
></div> ></div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<div <div
@ -185,6 +189,11 @@ exports[`attributes.component.html - angular-verify 1`] = `
}" }"
[error]="'We couldn\\\\\\'t find anything with that name.'" [error]="'We couldn\\\\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="{
'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER
}"
></div> ></div>
`; `;
@ -270,6 +279,10 @@ exports[`attributes.component.html - angular-verify 2`] = `
[target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }" [target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }"
[error]="'We couldn\\\\\\'t find anything with that name.'" [error]="'We couldn\\\\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="
{'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER}"
></div> ></div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<div <div
@ -374,6 +387,11 @@ exports[`attributes.component.html - angular-verify 2`] = `
}" }"
[error]="'We couldn\\\\\\'t find anything with that name.'" [error]="'We couldn\\\\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="{
'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER
}"
></div> ></div>
`; `;
@ -459,6 +477,10 @@ exports[`attributes.component.html - angular-verify 3`] = `
[target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }" [target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }"
[error]="'We couldn\\\\\\'t find anything with that name.'" [error]="'We couldn\\\\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="
{'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER}"
></div> ></div>
~ ~
<div <div
@ -767,6 +789,29 @@ exports[`attributes.component.html - angular-verify 3`] = `
?.errors ?.errors
.min .min
" "
[ngClass]="{
'btn-success':
(
dialog$
| async
)
.level ===
dialogLevelEnum.SUCCESS,
'btn-warning':
(
dialog$
| async
)
.level ===
dialogLevelEnum.WARNING,
'btn-svg':
(
dialog$
| async
)
.level ===
dialogLevelEnum.DANGER
}"
></div> ></div>
`; `;

View File

@ -78,4 +78,8 @@
[target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }" [target]="{ longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong: true }"
[error]="'We couldn\\\'t find anything with that name.'" [error]="'We couldn\\\'t find anything with that name.'"
*ngIf="form.controls.details?.controls.amount?.errors.min" *ngIf="form.controls.details?.controls.amount?.errors.min"
[ngClass]="
{'btn-success': (dialog$ | async).level === dialogLevelEnum.SUCCESS,
'btn-warning': (dialog$ | async).level === dialogLevelEnum.WARNING,
'btn-svg': (dialog$ | async).level === dialogLevelEnum.DANGER}"
></div> ></div>

View File

@ -704,9 +704,9 @@ amdefine@>=0.0.4:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
angular-estree-parser@1.1.3: angular-estree-parser@1.1.4:
version "1.1.3" version "1.1.4"
resolved "https://registry.yarnpkg.com/angular-estree-parser/-/angular-estree-parser-1.1.3.tgz#679b7a1ab57e56cd484b5c44e380bcec7633df58" resolved "https://registry.yarnpkg.com/angular-estree-parser/-/angular-estree-parser-1.1.4.tgz#173fd2a9a30ccd38864e879e66b83cbbbdfd45db"
dependencies: dependencies:
lines-and-columns "^1.1.6" lines-and-columns "^1.1.6"
tslib "^1.9.3" tslib "^1.9.3"