File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
packages/ra-ui-materialui/src/input Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ describe('<SelectInput />', () => {
7979 ) . toEqual ( 'rea' ) ;
8080 } ) ;
8181
82- it ( 'should render disabled choices marked so' , ( ) => {
82+ it ( 'should render disabled choices marked as so' , ( ) => {
8383 render (
8484 < AdminContext dataProvider = { testDataProvider ( ) } >
8585 < ResourceContextProvider value = "posts" >
@@ -111,6 +111,39 @@ describe('<SelectInput />', () => {
111111 ) . toEqual ( 'true' ) ;
112112 } ) ;
113113
114+ it ( 'should render disabled choices marked as so by disableValue prop' , ( ) => {
115+ render (
116+ < AdminContext dataProvider = { testDataProvider ( ) } >
117+ < ResourceContextProvider value = "posts" >
118+ < SimpleForm onSubmit = { jest . fn ( ) } >
119+ < SelectInput
120+ { ...defaultProps }
121+ choices = { [
122+ { id : 'ang' , name : 'Angular' } ,
123+ {
124+ id : 'rea' ,
125+ name : 'React' ,
126+ not_available : true ,
127+ } ,
128+ ] }
129+ disableValue = "not_available"
130+ />
131+ </ SimpleForm >
132+ </ ResourceContextProvider >
133+ </ AdminContext >
134+ ) ;
135+ fireEvent . mouseDown (
136+ screen . getByLabelText ( 'resources.posts.fields.language' )
137+ ) ;
138+
139+ expect (
140+ screen . getByText ( 'Angular' ) . getAttribute ( 'aria-disabled' )
141+ ) . toBeNull ( ) ;
142+ expect (
143+ screen . getByText ( 'React' ) . getAttribute ( 'aria-disabled' )
144+ ) . toEqual ( 'true' ) ;
145+ } ) ;
146+
114147 it ( 'should include an empty option by default' , ( ) => {
115148 render (
116149 < AdminContext dataProvider = { testDataProvider ( ) } >
You can’t perform that action at this time.
0 commit comments