@@ -47,6 +47,20 @@ import a11yAudit from 'ember-a11y-testing/test-support/audit';
47
47
48
48
// ...elided for brevity
49
49
50
+ test (' Some test case' , async function (assert ) {
51
+ await visit (' /' );
52
+ await a11yAudit ();
53
+ assert .ok (true , ' no a11y errors found!' );
54
+ });
55
+ ```
56
+
57
+ If your app does now allow async/await, you will need to use the the andThen() helper and a regular function (as opposed to ` async function ` ).
58
+
59
+ ``` javascript
60
+ import a11yAudit from ' ember-a11y-testing/test-support/audit' ;
61
+
62
+ // ...elided for brevity
63
+
50
64
test (' Some test case' , function (assert ) {
51
65
visit (' /' );
52
66
a11yAudit ();
@@ -59,7 +73,7 @@ either a selector string or an HTML element. You can also provide a secondary
59
73
parameter to specify axe-core options:
60
74
61
75
``` js
62
- test (' Some test case' , function (assert ) {
76
+ test (' Some test case' , async function (assert ) {
63
77
let axeOptions = {
64
78
rules: {
65
79
' button-name' : {
@@ -68,16 +82,16 @@ test('Some test case', function(assert) {
68
82
}
69
83
};
70
84
71
- visit (' /' );
72
- a11yAudit (axeOptions);
73
- andThen (() => assert .ok (true , ' no a11y errors found!' ) );
85
+ await visit (' /' );
86
+ await a11yAudit (axeOptions);
87
+ assert .ok (true , ' no a11y errors found!' );
74
88
});
75
89
```
76
90
77
91
Or specify options as a single argument:
78
92
79
93
``` js
80
- test (' Some test case' , function (assert ) {
94
+ test (' Some test case' , async function (assert ) {
81
95
let axeOptions = {
82
96
rules: {
83
97
' button-name' : {
@@ -86,9 +100,9 @@ test('Some test case', function(assert) {
86
100
}
87
101
};
88
102
89
- visit (' /' );
90
- a11yAudit (' .modal' , axeOptions);
91
- andThen (() => assert .ok (true , ' no a11y errors found!' ) );
103
+ await visit (' /' );
104
+ await a11yAudit (' .modal' , axeOptions);
105
+ assert .ok (true , ' no a11y errors found!' );
92
106
});
93
107
```
94
108
@@ -130,10 +144,10 @@ nightly build jobs.
130
144
``` javascript
131
145
import a11yAuditIf from ' ember-a11y-testing/test-support/audit-if' ;
132
146
133
- test (' Some test case' , function (assert ) {
134
- visit (' /' );
135
- a11yAuditIf (); // Only runs when enableA11yAudit=true is in the URL
136
- andThen (() => assert .ok (true , ' no a11y errors found!' ) );
147
+ test (' Some test case' , await function (assert ) {
148
+ await visit (' /' );
149
+ await a11yAuditIf (); // Only runs when enableA11yAudit=true is in the URL
150
+ assert .ok (true , ' no a11y errors found!' );
137
151
});
138
152
```
139
153
0 commit comments