Skip to content

Commit

Permalink
feat(HTL-111103): Update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
coolestKev committed Nov 5, 2024
1 parent 122fc7c commit 6e5c268
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/core/src/Drawer/Drawer.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react'
import { render } from '../__test__/testing-library'
import { Drawer } from './Drawer'
import { Flex } from '../Flex/Flex'
import { Button } from '../Button/Button'

describe('Drawer', () => {
test('renders Drawer with no heading', () => {
Expand Down Expand Up @@ -48,4 +50,25 @@ describe('Drawer', () => {
)
expect(getByText('Custom Heading')).toBeTruthy()
})

test('renders Drawer with full custom headers (text, buttons, etc.)', () => {
const CustomHeader = (
<Flex data-testid='custom-header'>
CustomHeader<Button ml='auto'>Click</Button>
</Flex>
)

const { getByTestId } = render(
<Drawer
isOpen={true}
placement='right'
onClose={jest.fn}
onCollapse={jest.fn}
customHeader={CustomHeader}
>
Content
</Drawer>
)
expect(getByTestId('custom-header')).toBeTruthy()
})
})

0 comments on commit 6e5c268

Please sign in to comment.