File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 123123 border-color : $checkbox-hovered-border-color ;
124124 background-color : $checkbox-hovered-bg-color ;
125125 }
126+ #{$checkbox-prefix } -label {
127+ cursor : pointer ;
128+ }
126129 }
127130
128131 & .indeterminate :not (.disabled ):hover ,
Original file line number Diff line number Diff line change 2222 width : $radio-width ;
2323 height : $radio-width ;
2424 margin : 0 ;
25+ cursor : pointer ;
2526 }
2627 }
2728
108109 border-color : $radio-hovered-border-color ;
109110 background-color : $radio-hovered-bg-color ;
110111 }
112+ #{$radio-prefix } -label {
113+ cursor : pointer ;
114+ }
111115 }
112116
113117 & .checked :not (.disabled ):hover ,
274278 top : 0 ;
275279 left : 0 ;
276280 margin : 0 ;
277- cursor : pointer ;
278281 }
279282 }
280283 & -group {
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import Enzyme from 'enzyme' ;
2+ import Enzyme , { mount } from 'enzyme' ;
33import Adapter from 'enzyme-adapter-react-16' ;
4+ import assert from 'power-assert' ;
45import Radio from '../../src/radio/index' ;
56import '../../src/radio/style' ;
67import { unmount , testReact } from '../util/a11y/validate' ;
@@ -98,4 +99,37 @@ describe('Radio A11y', () => {
9899 ) ;
99100 return wrapper ;
100101 } ) ;
102+
103+ it ( 'should add tabIndex for first Radio Item' , async ( ) => {
104+ const wrapper = mount (
105+ < Radio . Group >
106+ < Radio id = "pear" value = "pear" checked > ={ true }
107+ 梨子
108+ </ Radio >
109+ < Radio id = "apple" value = "apple" className = "apple" >
110+ 苹果
111+ </ Radio >
112+ </ Radio . Group >
113+ ) ;
114+ wrapper . update ( ) ;
115+ assert ( wrapper . find ( "input#pear" ) . at ( 0 ) . getDOMNode ( ) . tabIndex === 0 ) ;
116+ } ) ;
117+
118+ it ( 'should not add tabIndex for non Radio Item' , async ( ) => {
119+ const wrapper = mount (
120+ < Radio . Group defaultValue = { 'pear' } >
121+ < div id = "mywrapper" >
122+ < Radio id = "pear" value = "pear" >
123+ 梨子
124+ </ Radio >
125+ </ div >
126+ < div id = 'another' tabIndex = "-100" >
127+ < Radio id = "apple" value = "apple" className = "apple" >
128+ 苹果
129+ </ Radio >
130+ </ div >
131+ </ Radio . Group >
132+ ) ;
133+ assert ( wrapper . find ( "div#mywrapper" ) . at ( 0 ) . getDOMNode ( ) . tabIndex === - 1 ) ;
134+ } ) ;
101135} ) ;
You can’t perform that action at this time.
0 commit comments