diff --git a/packages/mui-material/src/Dialog/Dialog.test.js b/packages/mui-material/src/Dialog/Dialog.test.js index a0eb5c3d8ee823..a25e0541f6bd8e 100644 --- a/packages/mui-material/src/Dialog/Dialog.test.js +++ b/packages/mui-material/src/Dialog/Dialog.test.js @@ -318,6 +318,39 @@ describe('', () => { ); expect(getByTestId('paper')).not.to.have.class(classes.paperFullScreen); }); + + it('scrolls if overflown on the Y axis', function test() { + if (/jsdom/.test(window.navigator.userAgent)) { + this.skip(); + } + + const ITEM_HEIGHT = 100; + const ITEM_COUNT = 10; + + const { getByTestId } = render( + + {Array.from(Array(ITEM_COUNT).keys()).map((item) => ( +
+ {item} +
+ ))} +
, + ); + const paperElement = getByTestId('paper'); + expect(paperElement.scrollTop).to.equal(0); + expect(paperElement.clientHeight).to.equal(ITEM_HEIGHT); + expect(paperElement.scrollHeight).to.equal(ITEM_HEIGHT * ITEM_COUNT); + fireEvent.scroll(getByTestId('paper'), { target: { scrollTop: ITEM_HEIGHT } }); + expect(paperElement.scrollTop).to.equal(ITEM_HEIGHT); + }); }); describe('prop: PaperProps.className', () => {