3
3
4
4
<p style =" font-size : 400% ; line-height : 1 ; margin : 0 " >🎬</p >
5
5
6
- <p >Test if your component fits a role .</p >
6
+ <p >Test that your components can play the accessibility roles we need .</p >
7
7
8
8
</div >
9
9
16
16
- [ Tabs] ( #tabs )
17
17
- [ Checkboxes] ( #checkboxes )
18
18
- [ Menus] ( #menus )
19
+ - [ Scene] ( #scene )
19
20
20
21
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
21
22
34
35
#### Examples
35
36
36
37
``` ts
37
- import { screenTest , tablist , tabs , tab , tabpanel } from " auditioner" ;
38
+ import { screenTest , tablist , tabs , tab , tabpanel } from ' auditioner' ;
38
39
39
- describe (" your tabs component" , () => {
40
+ describe (' your tabs component' , () => {
40
41
beforeEach (() => render (<Tabs />));
41
42
42
- it (" renders 3 tabs" , () => {
43
+ it (' renders 3 tabs' , () => {
43
44
expect (screenTest (tabs ())).toHaveLength (3 );
44
45
});
45
46
46
- it (" selects first tab" , () => {
47
- expect (screenTest (tab (" First" ).selected )).toBeInTheDocument ();
47
+ it (' selects first tab' , () => {
48
+ expect (screenTest (tab (' First' ).selected )).toBeInTheDocument ();
48
49
});
49
50
50
- it (" renders first tabpanel" , () => {
51
- expect (screenTest (tabpanel ())).toHaveTextContent (" First panel" );
51
+ it (' renders first tabpanel' , () => {
52
+ expect (screenTest (tabpanel ())).toHaveTextContent (' First panel' );
52
53
});
53
54
54
- describe (" when clicking on second tab" , () => {
55
+ describe (' when clicking on second tab' , () => {
55
56
beforeEach (() => {
56
- user .click (screenTest (tab (" Second" )));
57
+ user .click (screenTest (tab (' Second' )));
57
58
});
58
59
59
- it (" selects second tab" , () => {
60
- expect (screenTest (tab (" Second" ).selected )).toBeInTheDocument ();
60
+ it (' selects second tab' , () => {
61
+ expect (screenTest (tab (' Second' ).selected )).toBeInTheDocument ();
61
62
});
62
63
63
- it (" renders second tabpanel" , () => {
64
- expect (screenTest (tabpanel ())).toHaveTextContent (" Second panel" );
64
+ it (' renders second tabpanel' , () => {
65
+ expect (screenTest (tabpanel ())).toHaveTextContent (' Second panel' );
65
66
});
66
67
});
67
68
});
@@ -72,18 +73,18 @@ describe("your tabs component", () => {
72
73
#### Examples
73
74
74
75
``` ts
75
- import { checkbox , checkboxes , screenTest } from " auditioner" ;
76
+ import { checkbox , checkboxes , screenTest } from ' auditioner' ;
76
77
77
- describe (" your form component" , () => {
78
+ describe (' your form component' , () => {
78
79
beforeEach (() => {
79
80
render (<YourForm />);
80
81
});
81
82
82
- it (" has First checkbox" , () => {
83
- expect (screenTest (checkbox (" First" ))).toBeInTheDocument ();
83
+ it (' has First checkbox' , () => {
84
+ expect (screenTest (checkbox (' First' ))).toBeInTheDocument ();
84
85
});
85
86
86
- it (" has 3 checkboxes" , () => {
87
+ it (' has 3 checkboxes' , () => {
87
88
expect (screenTest (checkboxes ())).toHaveLength (3 );
88
89
});
89
90
});
@@ -94,30 +95,30 @@ describe("your form component", () => {
94
95
#### Examples
95
96
96
97
``` ts
97
- import { button , menu , menuitem , menuitems , screenTest } from " auditioner" ;
98
- import user from " @testing-library/user-event" ;
98
+ import { button , menu , menuitem , menuitems , screenTest } from ' auditioner' ;
99
+ import user from ' @testing-library/user-event' ;
99
100
100
- describe (" your menu component" , () => {
101
+ describe (' your menu component' , () => {
101
102
beforeEach (() => {
102
103
render (<YourMenu />);
103
104
});
104
105
105
- describe (" when action menu is clicked" , () => {
106
- beforeEach (() => user .click (screenTest (button (" Actions" ))));
106
+ describe (' when action menu is clicked' , () => {
107
+ beforeEach (() => user .click (screenTest (button (' Actions' ))));
107
108
108
- it (" opens menu" , () => {
109
- expect (screenTest (menu (" Actions" ))).toBeVisible ();
109
+ it (' opens menu' , () => {
110
+ expect (screenTest (menu (' Actions' ))).toBeVisible ();
110
111
});
111
112
112
- it (" has Cut item" , () => {
113
- expect (screenTest (menuitem (" Actions" ))).toBeVisible ();
113
+ it (' has Cut item' , () => {
114
+ expect (screenTest (menuitem (' Actions' ))).toBeVisible ();
114
115
});
115
116
116
- it (" has Cut, Copy, Paste items" , () => {
117
+ it (' has Cut, Copy, Paste items' , () => {
117
118
const [cut, copy, paste] = screenTest (menuitems ());
118
- expect (cut ).toHaveTextContent (" Cut" );
119
- expect (copy ).toHaveTextContent (" Copy" );
120
- expect (paste ).toHaveTextContent (" Paste" );
119
+ expect (cut ).toHaveTextContent (' Cut' );
120
+ expect (copy ).toHaveTextContent (' Copy' );
121
+ expect (paste ).toHaveTextContent (' Paste' );
121
122
});
122
123
});
123
124
});
@@ -126,15 +127,15 @@ describe("your menu component", () => {
126
127
### Scene
127
128
128
129
``` ts
129
- import { scene } from " auditioner" ;
130
+ import { scene } from ' auditioner' ;
130
131
131
132
expect (
132
133
screenTest (
133
134
scene (
134
- form (" Sign up" , [
135
- textbox (" Email address" ),
136
- textbox (" Password" ),
137
- button (" Sign up" ),
135
+ form (' Sign up' , [
136
+ textbox (' Email address' ),
137
+ textbox (' Password' ),
138
+ button (' Sign up' ),
138
139
])
139
140
)
140
141
)
0 commit comments