Skip to content

Commit

Permalink
drawer add test
Browse files Browse the repository at this point in the history
  • Loading branch information
yash49 committed Jan 12, 2025
1 parent 4f6a17d commit 6ad037e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/mui-material/src/Drawer/Drawer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,25 @@ describe('<Drawer />', () => {
});
});
});

describe('prop: anchor', () => {
it('should set correct class name on the root element', () => {
const { setProps } = render(
<Drawer open anchor="left">
<div />
</Drawer>,
);

expect(document.querySelector(`.${classes.root}`)).to.have.class(classes.anchorLeft);

setProps({ anchor: 'right' });
expect(document.querySelector(`.${classes.root}`)).to.have.class(classes.anchorRight);

setProps({ anchor: 'top' });
expect(document.querySelector(`.${classes.root}`)).to.have.class(classes.anchorTop);

setProps({ anchor: 'bottom' });
expect(document.querySelector(`.${classes.root}`)).to.have.class(classes.anchorBottom);
});
});
});

0 comments on commit 6ad037e

Please sign in to comment.