|
1 | | -import {cleanup, render, screen} from '@testing-library/react' |
| 1 | +import {render, screen} from '@testing-library/react' |
2 | 2 | import userEvent from '@testing-library/user-event' |
3 | 3 | import React from 'react' |
4 | | -import {Banner, BannerVariant} from '../Banner' |
| 4 | +import {Banner} from '../Banner' |
5 | 5 | import {FeatureFlags} from '../FeatureFlags' |
6 | 6 |
|
7 | 7 | describe('Banner', () => { |
@@ -169,15 +169,14 @@ describe('Banner', () => { |
169 | 169 | expect(onDismiss).toHaveBeenCalledTimes(3) |
170 | 170 | }) |
171 | 171 |
|
172 | | - it('should support onDismiss for all variants', () => { |
173 | | - const onDismiss = jest.fn() |
174 | | - const variantTypes: BannerVariant[] = ['critical', 'info', 'success', 'upsell', 'warning'] |
175 | | - variantTypes.map(variant => { |
176 | | - cleanup() |
| 172 | + it.each(['critical', 'info', 'success', 'upsell', 'warning'] as const)( |
| 173 | + 'should support onDismiss for the %s variant', |
| 174 | + variant => { |
| 175 | + const onDismiss = jest.fn() |
177 | 176 | render(<Banner title="test" description="test-description" onDismiss={onDismiss} variant={variant} />) |
178 | | - expect(screen.queryByRole('button', {name: 'Dismiss banner'})).toBeTruthy() |
179 | | - }) |
180 | | - }) |
| 177 | + expect(screen.queryByRole('button', {name: 'Dismiss banner'})).toBeInTheDocument() |
| 178 | + }, |
| 179 | + ) |
181 | 180 |
|
182 | 181 | it('should pass extra props onto the container element', () => { |
183 | 182 | const {container} = render(<Banner title="test" data-testid="test" />) |
|
0 commit comments