File tree Expand file tree Collapse file tree 4 files changed +93
-1
lines changed Expand file tree Collapse file tree 4 files changed +93
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ var __meta__ = { // jshint ignore:line
147147 }
148148
149149 that . _heightHandler = proxy ( that . _height , that ) ;
150-
150+ that . _ariaLabel ( ) ;
151151 that . _popup ( ) ;
152152 } ;
153153
@@ -175,6 +175,32 @@ var __meta__ = { // jshint ignore:line
175175 this . list . on ( "keydown" + ns , proxy ( this . _scrollerKeyDownHandler , this ) ) ;
176176 } ,
177177
178+ _ariaLabel : function ( ) {
179+ var that = this ;
180+ var inputElm = $ ( "#" + that . options . id ) ;
181+ var ul = that . ul ;
182+ var id = inputElm . attr ( "id" ) ;
183+ var labelElm = $ ( "label[for=\'" + id + "\']" ) ;
184+ var ariaLabel = inputElm . attr ( "aria-label" ) ;
185+ var ariaLabelledBy = inputElm . attr ( "aria-labelledby" ) ;
186+ var labelId ;
187+
188+ if ( ariaLabel ) {
189+ ul . attr ( "aria-label" , ariaLabel ) ;
190+ } else if ( ariaLabelledBy ) {
191+ ul . attr ( "aria-labelledby" , ariaLabelledBy ) ;
192+ } else if ( labelElm . length ) {
193+ labelId = labelElm . attr ( "id" ) ;
194+ if ( labelId ) {
195+ ul . attr ( "aria-labelledby" , labelId ) ;
196+ } else {
197+ labelId = kendo . guid ( ) ;
198+ labelElm . attr ( "id" , labelId ) ;
199+ ul . attr ( "aria-labelledby" , labelId ) ;
200+ }
201+ }
202+ } ,
203+
178204 _scrollerKeyDownHandler : function ( e ) {
179205 var that = this ,
180206 key = e . keyCode ,
Original file line number Diff line number Diff line change 2424 assert . equal ( widget . element . attr ( "aria-disabled" ) , "true" ) ;
2525 } ) ;
2626 } ) ;
27+
28+ describe ( "kendo.ui.TextArea AXE" , function ( ) {
29+ beforeEach ( function ( ) {
30+ $ ( "<textarea />" ) . appendTo ( Mocha . fixture ) ;
31+ textarea = $ ( Mocha . fixture ) . find ( "textarea" ) ;
32+ } ) ;
33+ afterEach ( function ( ) {
34+ kendo . destroy ( Mocha . fixture ) ;
35+ } ) ;
36+
37+ it ( "TextArea is accessible" , function ( done ) {
38+ var widget = new TextArea ( textarea , {
39+ label : {
40+ content : "Text"
41+ }
42+ } ) ;
43+
44+ axeRunFixture ( done ) ;
45+ } ) ;
46+ } ) ;
2747} ( ) ) ;
Original file line number Diff line number Diff line change 2424 assert . equal ( textbox . element . attr ( "aria-disabled" ) , "true" ) ;
2525 } ) ;
2626 } ) ;
27+
28+ describe ( "kendo.ui.TextBox AXE" , function ( ) {
29+ beforeEach ( function ( ) {
30+ $ ( "<input />" ) . appendTo ( Mocha . fixture ) ;
31+ input = $ ( Mocha . fixture ) . find ( "input" ) ;
32+ } ) ;
33+ afterEach ( function ( ) {
34+ kendo . destroy ( Mocha . fixture ) ;
35+ } ) ;
36+
37+ it ( "TextBox is accessible" , function ( done ) {
38+ var textbox = new TextBox ( input , {
39+ label : {
40+ content : "Name" ,
41+ floating : true
42+ }
43+ } ) ;
44+
45+ axeRunFixture ( done ) ;
46+ } ) ;
47+ } ) ;
2748} ( ) ) ;
Original file line number Diff line number Diff line change 9999
100100
101101 } ) ;
102+
103+ describe ( "kendo.ui.TimePicker aria with AXE" , function ( ) {
104+ beforeEach ( function ( ) {
105+ $ ( "<label for='hiredate'>Deliver hour</label><input id='hiredate' />" ) . appendTo ( Mocha . fixture ) ;
106+ input = $ ( Mocha . fixture ) . find ( "input" ) ;
107+ } ) ;
108+
109+ afterEach ( function ( ) {
110+ kendo . destroy ( Mocha . fixture ) ;
111+ } ) ;
112+
113+ it ( "TimePicker is accessible" , function ( done ) {
114+ var timepicker = new TimePicker ( input ) ;
115+
116+ axeRunFixture ( done ) ;
117+ } ) ;
118+
119+ it ( "TimePicker has accessible time popup" , function ( done ) {
120+ instance = new TimePicker ( input ) ;
121+
122+ instance . open ( ) ;
123+
124+ axeRun ( instance . timeView . popup . element [ 0 ] , done , [ "scrollable-region-focusable" ] ) ;
125+ } ) ;
126+ } ) ;
102127} ( ) ) ;
You can’t perform that action at this time.
0 commit comments