Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tcbegley committed May 6, 2024
1 parent 09c8190 commit 7104b89
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/modal/__tests__/Modal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ describe('Modal', () => {
'custom-modal-content'
);

// Content style
rerender(<Modal is_open content_style={{backgroundColor: 'red'}} />);
expect(document.body.querySelector('.modal-content')).toHaveStyle({
backgroundColor: 'red'
});

// Backdrop class name
rerender(<Modal is_open backdrop_class_name="custom-modal-backdrop" />);
expect(document.body.querySelector('.modal-backdrop')).toHaveClass(
Expand All @@ -87,6 +93,19 @@ describe('Modal', () => {
'custom-modal-dialog'
);

// Dialog style
rerender(
<Modal
is_open
dialog_style={{position: 'absolute', top: '10px', left: '10px'}}
/>
);
expect(document.body.querySelector('.modal-dialog')).toHaveStyle({
position: 'absolute',
top: '10px',
left: '10px'
});

// Modal class name
rerender(<Modal is_open modal_class_name="custom-modal-class" />);
expect(document.body.querySelector('.modal')).toHaveClass(
Expand Down

0 comments on commit 7104b89

Please sign in to comment.