-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/783-trigger-modal-using-approval-contro…
…ller-on-qr-signing
- Loading branch information
Showing
6 changed files
with
526 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
app/component-library/components/Banners/Banner/Banner.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React from 'react'; | ||
|
||
import { render } from '@testing-library/react-native'; | ||
import Banner from './Banner'; | ||
import Text from '../../Texts/Text/Text'; | ||
import { BannerAlertSeverity } from './variants/BannerAlert/BannerAlert.types'; | ||
import { BannerVariant } from './Banner.types'; | ||
import { ButtonVariants } from '../../Buttons/Button'; | ||
import { IconName } from '../../Icons/Icon'; | ||
import { ButtonIconSizes, ButtonIconVariants } from '../../Buttons/ButtonIcon'; | ||
import { TESTID_BANNER_CLOSE_BUTTON_ICON } from './foundation/BannerBase/BannerBase.constants'; | ||
|
||
describe('Banner', () => { | ||
it('should render correctly', () => { | ||
const wrapper = render( | ||
<Banner | ||
severity={BannerAlertSeverity.Error} | ||
variant={BannerVariant.Alert} | ||
title="Hello Error Banner World" | ||
description={ | ||
'This is nothing but a test of the emergency broadcast system.' | ||
} | ||
/>, | ||
); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render correctly with a start accessory', async () => { | ||
const wrapper = render( | ||
<Banner | ||
severity={BannerAlertSeverity.Error} | ||
variant={BannerVariant.Alert} | ||
title="Hello Error Banner World" | ||
description={ | ||
'This is nothing but a test of the emergency broadcast system.' | ||
} | ||
startAccessory={<Text>Test Start accessory</Text>} | ||
/>, | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
expect(await wrapper.findByText('Test Start accessory')).toBeDefined(); | ||
}); | ||
|
||
it('should render correctly with an action button', async () => { | ||
const wrapper = render( | ||
<Banner | ||
severity={BannerAlertSeverity.Error} | ||
variant={BannerVariant.Alert} | ||
title="Hello Error Banner World" | ||
description={ | ||
'This is nothing but a test of the emergency broadcast system.' | ||
} | ||
actionButtonProps={{ | ||
label: 'Test Action Button', | ||
onPress: () => jest.fn(), | ||
variant: ButtonVariants.Secondary, | ||
}} | ||
/>, | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
expect(await wrapper.findByText('Test Action Button')).toBeDefined(); | ||
}); | ||
|
||
it('should render correctly with a close button', async () => { | ||
const wrapper = render( | ||
<Banner | ||
severity={BannerAlertSeverity.Error} | ||
variant={BannerVariant.Alert} | ||
title="Hello Error Banner World" | ||
description={ | ||
'This is nothing but a test of the emergency broadcast system.' | ||
} | ||
actionButtonProps={{ | ||
label: 'Test Action Button', | ||
onPress: () => jest.fn(), | ||
variant: ButtonVariants.Secondary, | ||
}} | ||
closeButtonProps={{ | ||
onPress: () => jest.fn(), | ||
iconName: IconName.Close, | ||
variant: ButtonIconVariants.Primary, | ||
size: ButtonIconSizes.Sm, | ||
}} | ||
/>, | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
expect(await wrapper.findByText('Test Action Button')).toBeDefined(); | ||
expect( | ||
await wrapper.queryByTestId(TESTID_BANNER_CLOSE_BUTTON_ICON), | ||
).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.