Skip to content

Commit ede98f8

Browse files
committed
test(Banner): update test for info and upsell custom icons
1 parent 5a940f1 commit ede98f8

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

packages/react/src/Banner/Banner.test.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,31 +160,14 @@ describe('Banner', () => {
160160
expect(container.firstChild).toHaveAttribute('data-testid', 'test')
161161
})
162162

163-
it('should support a custom icon only for info variants', () => {
163+
it('should support a custom icon for info and upsell variants', () => {
164164
const CustomIcon = jest.fn(() => <svg data-testid="icon" aria-hidden="true" />)
165165
const {rerender} = render(
166166
<Banner title="test" description="test-description" variant="info" icon={<CustomIcon />} />,
167167
)
168168
expect(screen.getByTestId('icon')).toBeInTheDocument()
169169

170-
rerender(<Banner title="test" description="test-description" variant="critical" icon={<CustomIcon />} />)
171-
expect(screen.queryByTestId('icon')).toBe(null)
172-
173-
rerender(<Banner title="test" description="test-description" variant="success" icon={<CustomIcon />} />)
174-
expect(screen.queryByTestId('icon')).toBe(null)
175-
176170
rerender(<Banner title="test" description="test-description" variant="upsell" icon={<CustomIcon />} />)
177-
expect(screen.queryByTestId('icon')).toBe(null)
178-
179-
rerender(<Banner title="test" description="test-description" variant="warning" icon={<CustomIcon />} />)
180-
expect(screen.queryByTestId('icon')).toBe(null)
181-
})
182-
183-
it('should support a custom icon only for upsell variants', () => {
184-
const CustomIcon = jest.fn(() => <svg data-testid="icon" aria-hidden="true" />)
185-
const {rerender} = render(
186-
<Banner title="test" description="test-description" variant="upsell" icon={<CustomIcon />} />,
187-
)
188171
expect(screen.getByTestId('icon')).toBeInTheDocument()
189172

190173
rerender(<Banner title="test" description="test-description" variant="critical" icon={<CustomIcon />} />)
@@ -193,9 +176,6 @@ describe('Banner', () => {
193176
rerender(<Banner title="test" description="test-description" variant="success" icon={<CustomIcon />} />)
194177
expect(screen.queryByTestId('icon')).toBe(null)
195178

196-
rerender(<Banner title="test" description="test-description" variant="upsell" icon={<CustomIcon />} />)
197-
expect(screen.queryByTestId('icon')).toBe(null)
198-
199179
rerender(<Banner title="test" description="test-description" variant="warning" icon={<CustomIcon />} />)
200180
expect(screen.queryByTestId('icon')).toBe(null)
201181
})

0 commit comments

Comments
 (0)