File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -93,5 +93,27 @@ describe('tab-container', function() {
93
93
// The event listener should have been called.
94
94
assert . equal ( counter , 1 )
95
95
} )
96
+
97
+ it ( 'the aria-selected attribute is set to "false" for all tabs that don\'t have a aria-selected attribute' , function ( ) {
98
+ for ( const tab of document . querySelectorAll ( '[role="tab"]:not([aria-selected="true"])' ) ) {
99
+ assert . equal ( tab . getAttribute ( 'aria-selected' ) , 'false' )
100
+ }
101
+ } )
102
+
103
+ it ( 'the tabindex attribute is set to "0" for the selected tab' , function ( ) {
104
+ assert . equal ( document . querySelector ( '[role="tab"][aria-selected="true"]' ) . getAttribute ( 'tabindex' ) , '0' )
105
+ } )
106
+
107
+ it ( 'the tabindex attribute is set to "-1" for the non-selected tabs' , function ( ) {
108
+ for ( const tab of document . querySelectorAll ( '[role="tab"]:not([aria-selected="true"])' ) ) {
109
+ assert . equal ( tab . getAttribute ( 'tabindex' ) , '-1' )
110
+ }
111
+ } )
112
+ it ( 'selected tab has tabindex="0" after selection' , function ( ) {
113
+ const tabs = document . querySelectorAll ( '[role="tab"]' )
114
+
115
+ tabs [ 1 ] . click ( )
116
+ assert . equal ( tabs [ 1 ] . getAttribute ( 'tabindex' ) , '0' )
117
+ } )
96
118
} )
97
119
} )
You can’t perform that action at this time.
0 commit comments