Skip to content

Commit

Permalink
fix(eslint-plugin-template): [accessibility-valid-aria] use Number() …
Browse files Browse the repository at this point in the history
…to parse numeric values (#1218)
  • Loading branch information
sandikbarr committed Nov 24, 2022
1 parent a69c809 commit 6fe40d6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
Expand Up @@ -341,6 +341,32 @@ The rule does not have any configuration options.

#### ✅ Valid Code

```html
<table aria-rowcount="-1"></table>
```

<br>

---

<br>

#### Default Config

```json
{
"rules": {
"@angular-eslint/template/accessibility-valid-aria": [
"error"
]
}
}
```

<br>

#### ✅ Valid Code

```html
<div aria-relevant="additions">additions</div>
```
Expand Down Expand Up @@ -394,7 +420,33 @@ The rule does not have any configuration options.
#### ✅ Valid Code

```html
<div role="slider" [aria-valuemin]="1"></div>
<div role="slider" [attr.aria-valuemin]="1"></div>
```

<br>

---

<br>

#### Default Config

```json
{
"rules": {
"@angular-eslint/template/accessibility-valid-aria": [
"error"
]
}
}
```

<br>

#### ✅ Valid Code

```html
<div role="slider" aria-valuemin="1"></div>
```

<br>
Expand Down
Expand Up @@ -134,7 +134,7 @@ function isInteger(value: unknown): boolean {
function isNumeric(value: unknown): boolean {
return (
!Number.isNaN(Number.parseFloat(value as string)) &&
Number.isFinite(value as number)
Number.isFinite(Number(value))
);
}

Expand Down
Expand Up @@ -14,9 +14,11 @@ export const valid = [
'<div aria-haspopup="menu">aria-haspopup</div>',
'<div [attr.aria-pressed]="undefined">aria-pressed</div>',
'<input [attr.aria-rowcount]="2">',
'<table aria-rowcount="-1"></table>',
'<div aria-relevant="additions">additions</div>',
'<div aria-checked="false">checked</div>',
'<div role="slider" [aria-valuemin]="1"></div>',
'<div role="slider" [attr.aria-valuemin]="1"></div>',
'<div role="slider" aria-valuemin="1"></div>',
'<div aria-="text">Text</div>',
`
<input
Expand Down

0 comments on commit 6fe40d6

Please sign in to comment.