@@ -155,6 +155,44 @@ describe('<Drawer />', () => {
155155 } ) ;
156156 } ) ;
157157
158+ describe ( 'accessibility' , ( ) => {
159+ it ( 'should have role="dialog" and aria-modal="true" when variant is temporary' , ( ) => {
160+ render (
161+ < Drawer open variant = "temporary" >
162+ < div data-testid = "child" />
163+ </ Drawer > ,
164+ ) ;
165+
166+ const paper = document . querySelector ( `.${ classes . paper } ` ) ;
167+ expect ( paper ) . to . have . attribute ( 'role' , 'dialog' ) ;
168+ expect ( paper ) . to . have . attribute ( 'aria-modal' , 'true' ) ;
169+ } ) ;
170+
171+ it ( 'should not have role="dialog" and aria-modal="true" when variant is permanent' , ( ) => {
172+ render (
173+ < Drawer variant = "permanent" >
174+ < div data-testid = "child" />
175+ </ Drawer > ,
176+ ) ;
177+
178+ const paper = document . querySelector ( `.${ classes . paper } ` ) ;
179+ expect ( paper ) . not . to . have . attribute ( 'role' ) ;
180+ expect ( paper ) . not . to . have . attribute ( 'aria-modal' ) ;
181+ } ) ;
182+
183+ it ( 'should not have role="dialog" and aria-modal="true" when variant is persistent' , ( ) => {
184+ render (
185+ < Drawer variant = "persistent" >
186+ < div data-testid = "child" />
187+ </ Drawer > ,
188+ ) ;
189+
190+ const paper = document . querySelector ( `.${ classes . paper } ` ) ;
191+ expect ( paper ) . not . to . have . attribute ( 'role' ) ;
192+ expect ( paper ) . not . to . have . attribute ( 'aria-modal' ) ;
193+ } ) ;
194+ } ) ;
195+
158196 it ( 'should set the custom className for Modal when variant is temporary' , ( ) => {
159197 render (
160198 < Drawer className = "woofDrawer" open variant = "temporary" >
0 commit comments