11import '@progress/kendo-ui/src/kendo.actionsheet.js' ;
2+ import { TimerUtils } from '../../helpers/unit/timer-utils.js' ;
3+ import { asyncTest } from '../../helpers/unit/async-utils.js' ;
4+
25
36let ActionSheet = kendo . ui . ActionSheet ,
47 div ,
@@ -21,20 +24,21 @@ describe("kendo.ui.ActionSheet accessibility with AXE", function() {
2124 } , options ) ) ;
2225 }
2326 beforeEach ( function ( ) {
27+ TimerUtils . initTimer ( ) ;
2428 div = $ ( "<div style='color:green'></div>" ) . appendTo ( Mocha . fixture ) ;
2529
2630 } ) ;
2731 afterEach ( function ( ) {
32+ TimerUtils . destroyTimer ( ) ;
2833 instance . destroy ( ) ;
2934 kendo . destroy ( Mocha . fixture ) ;
3035 } ) ;
3136
32- it ( "ActionSheet is accessible" , async function ( ) {
37+ asyncTest ( "ActionSheet is accessible" , function ( done ) {
3338 createInstance ( {
3439 open : function ( e ) {
35- setTimeout ( async function ( ) {
36- await axeRunFixture ( ) ;
37- } ) ;
40+ TimerUtils . advanceTimer ( 1 ) ;
41+ done ( ( ) => axeRunFixture ( ) ) ;
3842 } ,
3943 } ) ;
4044
@@ -58,48 +62,77 @@ describe("kendo.ui.ActionSheet WAI-ARIA", function() {
5862 } , options ) ) ;
5963 }
6064 beforeEach ( function ( ) {
65+ TimerUtils . initTimer ( ) ;
6166 div = $ ( "<div style='color:green'></div>" ) . appendTo ( Mocha . fixture ) ;
6267
6368 } ) ;
6469 afterEach ( function ( ) {
70+ TimerUtils . destroyTimer ( ) ;
6571 instance . destroy ( ) ;
6672 kendo . destroy ( Mocha . fixture ) ;
6773 } ) ;
6874
69- it ( "ActionSheet items collection has role='group'" , async function ( ) {
75+ asyncTest ( "ActionSheet items collection has role='group'" , function ( done ) {
76+ createInstance ( {
77+ open : function ( ) {
78+ TimerUtils . advanceTimer ( 1 ) ;
79+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-list-ul" ) . attr ( "role" ) , "group" ) ) ;
80+ } ,
81+ } ) ;
82+
83+ instance . open ( ) ;
84+ } ) ;
85+
86+ asyncTest ( "ActionSheet li elements have role='none'" , function ( done ) {
7087 createInstance ( {
7188 open : function ( ) {
72- assert . equal ( instance . wrapper . find ( ".k-list-ul" ) . attr ( "role" ) , "group" ) ;
89+ TimerUtils . advanceTimer ( 1 ) ;
90+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-actionsheet-item" ) . attr ( "role" ) , "button" ) ) ;
7391 } ,
7492 } ) ;
7593
7694 instance . open ( ) ;
7795 } ) ;
7896
79- it ( "ActionSheet li elements have role='none '" , async function ( ) {
97+ asyncTest ( "ActionSheet has role='dialog '" , function ( done ) {
8098 createInstance ( {
8199 open : function ( ) {
82- assert . equal ( instance . wrapper . find ( ".k-actionsheet-item" ) . attr ( "role" ) , "button" ) ;
100+ TimerUtils . advanceTimer ( 1 ) ;
101+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "role" ) , "dialog" ) ) ;
83102 } ,
84103 } ) ;
85104
86105 instance . open ( ) ;
87106 } ) ;
88107
89- it ( "ActionSheet has role='dialog '" , async function ( ) {
108+ asyncTest ( "ActionSheet has aria-modal='true '" , function ( done ) {
90109 createInstance ( {
91110 open : function ( ) {
92- assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "role" ) , "dialog" ) ;
111+ TimerUtils . advanceTimer ( 1 ) ;
112+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "aria-modal" ) , "true" ) ) ;
113+ } ,
114+ } ) ;
115+
116+ instance . open ( ) ;
117+ } ) ;
118+
119+ asyncTest ( "ActionSheet has aria-hidden='true'" , function ( done ) {
120+ createInstance ( {
121+ close : function ( ) {
122+ TimerUtils . advanceTimer ( 1 ) ;
123+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "aria-hidden" ) , "true" ) ) ;
93124 } ,
94125 } ) ;
95126
96127 instance . open ( ) ;
128+ instance . close ( ) ;
97129 } ) ;
98130
99- it ( "ActionSheet has aria-modal='true '" , async function ( ) {
131+ asyncTest ( "ActionSheet has aria-hidden='false '" , function ( done ) {
100132 createInstance ( {
101133 open : function ( ) {
102- assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "aria-modal" ) , "true" ) ;
134+ TimerUtils . advanceTimer ( 1 ) ;
135+ done ( ( ) => assert . equal ( instance . wrapper . find ( ".k-actionsheet" ) . attr ( "aria-hidden" ) , "false" ) ) ;
103136 } ,
104137 } ) ;
105138
0 commit comments