@@ -228,7 +228,7 @@ describe('<SelectArrayInput />', () => {
228228 expect ( screen . queryByText ( 'Programming' ) ) . not . toBeNull ( ) ;
229229 } ) ;
230230
231- it ( 'should render disable choices marked so' , ( ) => {
231+ it ( 'should render disable choices marked as so' , ( ) => {
232232 render (
233233 < AdminContext dataProvider = { testDataProvider ( ) } >
234234 < ResourceContextProvider value = "posts" >
@@ -254,6 +254,37 @@ describe('<SelectArrayInput />', () => {
254254 expect ( option2 . getAttribute ( 'aria-disabled' ) ) . toEqual ( 'true' ) ;
255255 } ) ;
256256
257+ it ( 'should render disabled choices marked as so by disableValue prop' , ( ) => {
258+ render (
259+ < AdminContext dataProvider = { testDataProvider ( ) } >
260+ < ResourceContextProvider value = "posts" >
261+ < SimpleForm onSubmit = { jest . fn ( ) } >
262+ < SelectArrayInput
263+ { ...defaultProps }
264+ choices = { [
265+ { id : 'ang' , name : 'Angular' } ,
266+ {
267+ id : 'rea' ,
268+ name : 'React' ,
269+ not_available : true ,
270+ } ,
271+ ] }
272+ disableValue = "not_available"
273+ />
274+ </ SimpleForm >
275+ </ ResourceContextProvider >
276+ </ AdminContext >
277+ ) ;
278+ fireEvent . mouseDown (
279+ screen . getByLabelText ( 'resources.posts.fields.categories' )
280+ ) ;
281+ const option1 = screen . getByText ( 'Angular' ) ;
282+ expect ( option1 . getAttribute ( 'aria-disabled' ) ) . toBeNull ( ) ;
283+
284+ const option2 = screen . getByText ( 'React' ) ;
285+ expect ( option2 . getAttribute ( 'aria-disabled' ) ) . toEqual ( 'true' ) ;
286+ } ) ;
287+
257288 describe ( 'translateChoice' , ( ) => {
258289 it ( 'should translate the choices by default' , async ( ) => {
259290 render ( < TranslateChoice /> ) ;
0 commit comments