Skip to content

Commit

Permalink
feat: add proptype tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kwangure committed Dec 2, 2021
1 parent cf6641e commit e7763ae
Show file tree
Hide file tree
Showing 16 changed files with 402 additions and 0 deletions.
@@ -0,0 +1,8 @@
<script>
const abc = 'abc';
</script>

<div aria-hidden="yes"/>
<div aria-hidden="no"/>
<div aria-hidden={1234}/>
<div aria-hidden={`${abc}`}/>
@@ -0,0 +1,32 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"end": {
"character": 63,
"column": 22,
"line": 5
},
"message": "A11y: The value of 'aria-hidden' must be exactly one of true, false, or undefined",
"pos": 46,
"start": {
"character": 46,
"column": 5,
"line": 5
}
},
{
"code": "a11y-incorrect-aria-attribute-type",
"end": {
"character": 87,
"column": 21,
"line": 6
},
"message": "A11y: The value of 'aria-hidden' must be exactly one of true, false, or undefined",
"pos": 71,
"start": {
"character": 71,
"column": 5,
"line": 6
}
}
]
@@ -0,0 +1,8 @@
<script>
const abc = 'abc';
</script>

<button aria-disabled="yes"/>
<button aria-disabled="no"/>
<button aria-disabled={1234}/>
<button aria-disabled={`${abc}`}/>
32 changes: 32 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-boolean/warnings.json
@@ -0,0 +1,32 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-disabled' must be exactly one of true or false",
"start": {
"line": 5,
"column": 8,
"character": 51
},
"end": {
"line": 5,
"column": 27,
"character": 70
},
"pos": 51
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-disabled' must be exactly one of true or false",
"start": {
"line": 6,
"column": 8,
"character": 81
},
"end": {
"line": 6,
"column": 26,
"character": 99
},
"pos": 81
}
]
@@ -0,0 +1,7 @@
<div aria-level="yes" />
<div aria-level="no" />
<div aria-level={`abc`} />
<div aria-level={true} />
<div aria-level />
<div aria-level={"false"} />
<div aria-level={!"false"} />
47 changes: 47 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-integer/warnings.json
@@ -0,0 +1,47 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-level' must be of type integer",
"start": {
"line": 1,
"column": 5,
"character": 5
},
"end": {
"line": 1,
"column": 21,
"character": 21
},
"pos": 5
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-level' must be of type integer",
"start": {
"line": 2,
"column": 5,
"character": 30
},
"end": {
"line": 2,
"column": 20,
"character": 45
},
"pos": 30
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-level' must be of type integer",
"start": {
"line": 5,
"column": 5,
"character": 107
},
"end": {
"line": 5,
"column": 15,
"character": 117
},
"pos": 107
}
]
@@ -0,0 +1,7 @@
<div aria-valuemax="yes" />
<div aria-valuemax="no" />
<div aria-valuemax={`abc`} />
<div aria-valuemax={true} />
<div aria-valuemax />
<div aria-valuemax={'false'} />
<div aria-valuemax={!'false'} />
47 changes: 47 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-number/warnings.json
@@ -0,0 +1,47 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-valuemax' must be of type number",
"start": {
"line": 1,
"column": 5,
"character": 5
},
"end": {
"line": 1,
"column": 24,
"character": 24
},
"pos": 5
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-valuemax' must be of type number",
"start": {
"line": 2,
"column": 5,
"character": 33
},
"end": {
"line": 2,
"column": 23,
"character": 51
},
"pos": 33
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-valuemax' must be of type number",
"start": {
"line": 5,
"column": 5,
"character": 119
},
"end": {
"line": 5,
"column": 18,
"character": 132
},
"pos": 119
}
]
@@ -0,0 +1,5 @@
<div aria-label />
<div aria-label={true} />
<div aria-label={false} />
<div aria-label={1234} />
<div aria-label={!true} />
17 changes: 17 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-string/warnings.json
@@ -0,0 +1,17 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-label' must be of type string",
"start": {
"line": 1,
"column": 5,
"character": 5
},
"end": {
"line": 1,
"column": 15,
"character": 15
},
"pos": 5
}
]
6 changes: 6 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-token/input.svelte
@@ -0,0 +1,6 @@
<div aria-sort="" />
<div aria-sort="descnding" />
<div aria-sort />
<div aria-sort={true} />
<div aria-sort={"false"} />
<div aria-sort="ascending descending" />
62 changes: 62 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-token/warnings.json
@@ -0,0 +1,62 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other",
"start": {
"line": 1,
"column": 5,
"character": 5
},
"end": {
"line": 1,
"column": 17,
"character": 17
},
"pos": 5
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other",
"start": {
"line": 2,
"column": 5,
"character": 26
},
"end": {
"line": 2,
"column": 26,
"character": 47
},
"pos": 26
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other",
"start": {
"line": 3,
"column": 5,
"character": 56
},
"end": {
"line": 3,
"column": 14,
"character": 65
},
"pos": 56
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other",
"start": {
"line": 6,
"column": 5,
"character": 127
},
"end": {
"line": 6,
"column": 37,
"character": 159
},
"pos": 127
}
]
@@ -0,0 +1,7 @@
<div aria-relevant="" />
<div aria-relevant="foobar" />
<div aria-relevant />
<div aria-relevant={true} />
<div aria-relevant={"false"} />
<div aria-relevant="additions removalss" />
<div aria-relevant="additions removalss " />
77 changes: 77 additions & 0 deletions test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json
@@ -0,0 +1,77 @@
[
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text",
"start": {
"line": 1,
"column": 5,
"character": 5
},
"end": {
"line": 1,
"column": 21,
"character": 21
},
"pos": 5
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text",
"start": {
"line": 2,
"column": 5,
"character": 30
},
"end": {
"line": 2,
"column": 27,
"character": 52
},
"pos": 30
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text",
"start": {
"line": 3,
"column": 5,
"character": 61
},
"end": {
"line": 3,
"column": 18,
"character": 74
},
"pos": 61
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text",
"start": {
"line": 6,
"column": 5,
"character": 144
},
"end": {
"line": 6,
"column": 40,
"character": 179
},
"pos": 144
},
{
"code": "a11y-incorrect-aria-attribute-type",
"message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text",
"start": {
"line": 7,
"column": 5,
"character": 188
},
"end": {
"line": 7,
"column": 41,
"character": 224
},
"pos": 188
}
]
@@ -0,0 +1,8 @@
<script>
const abc = 'abc';
</script>

<div aria-checked="yes" />
<div aria-checked="no" />
<div aria-checked={1234} />
<div aria-checked={`${abc}`} />

0 comments on commit e7763ae

Please sign in to comment.