Skip to content

Commit

Permalink
feat: add tests to modalSize
Browse files Browse the repository at this point in the history
  • Loading branch information
demetriusfeijoo committed Dec 30, 2024
1 parent 19e4aaa commit 2bb1b58
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,44 @@ describe('createPluginActions', () => {
} satisfies Partial<ModalChangeMessage>),
)
})
it('sends modalSize to the container when opening the modal', () => {
const { uid, postToContainer, onUpdateState } = mock()
const {
actions: { setModalOpen },
} = createPluginActions({
uid,
postToContainer,
onUpdateState,
validateContent,
})

setModalOpen(true, { width: '50%' })
expect(postToContainer).toHaveBeenCalledWith(
expect.objectContaining({
event: 'toggleModal',
status: true,
modalSize: { width: '50%' },
} satisfies Partial<ModalChangeMessage>),
)

setModalOpen(true, { height: '50%' })
expect(postToContainer).toHaveBeenCalledWith(
expect.objectContaining({
event: 'toggleModal',
status: true,
modalSize: { height: '50%' },
} satisfies Partial<ModalChangeMessage>),
)

setModalOpen(true, { width: '50%', height: '50%' })
expect(postToContainer).toHaveBeenCalledWith(
expect.objectContaining({
event: 'toggleModal',
status: true,
modalSize: { width: '50%', height: '50%' },
} satisfies Partial<ModalChangeMessage>),
)
})
})
describe('value state change', () => {
it('updates the value state when setContent is called', () => {
Expand Down

0 comments on commit 2bb1b58

Please sign in to comment.