File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
packages/mui-material/src/Dialog Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,39 @@ describe('<Dialog />', () => {
318
318
) ;
319
319
expect ( getByTestId ( 'paper' ) ) . not . to . have . class ( classes . paperFullScreen ) ;
320
320
} ) ;
321
+
322
+ it ( 'scrolls if overflown on the Y axis' , function test ( ) {
323
+ if ( / j s d o m / . test ( window . navigator . userAgent ) ) {
324
+ this . skip ( ) ;
325
+ }
326
+
327
+ const ITEM_HEIGHT = 100 ;
328
+ const ITEM_COUNT = 10 ;
329
+
330
+ const { getByTestId } = render (
331
+ < Dialog
332
+ open
333
+ fullScreen
334
+ PaperProps = { { 'data-testid' : 'paper' , sx : { height : ITEM_HEIGHT } } }
335
+ >
336
+ { Array . from ( Array ( ITEM_COUNT ) . keys ( ) ) . map ( ( item ) => (
337
+ < div
338
+ key = { item }
339
+ style = { { flexShrink : 0 , height : ITEM_HEIGHT } }
340
+ data-testid = { `item-${ item } ` }
341
+ >
342
+ { item }
343
+ </ div >
344
+ ) ) }
345
+ </ Dialog > ,
346
+ ) ;
347
+ const paperElement = getByTestId ( 'paper' ) ;
348
+ expect ( paperElement . scrollTop ) . to . equal ( 0 ) ;
349
+ expect ( paperElement . clientHeight ) . to . equal ( ITEM_HEIGHT ) ;
350
+ expect ( paperElement . scrollHeight ) . to . equal ( ITEM_HEIGHT * ITEM_COUNT ) ;
351
+ fireEvent . scroll ( getByTestId ( 'paper' ) , { target : { scrollTop : ITEM_HEIGHT } } ) ;
352
+ expect ( paperElement . scrollTop ) . to . equal ( ITEM_HEIGHT ) ;
353
+ } ) ;
321
354
} ) ;
322
355
323
356
describe ( 'prop: PaperProps.className' , ( ) => {
You can’t perform that action at this time.
0 commit comments