Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [alert] UT for CTA icon #369

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/components/alert/test/alert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ describe('Alert tests', () => {
const findTitle = () => wrapper.find('.puik-alert__title')
const findDesc = () => wrapper.find('.puik-alert__description')
const findCloseButton = () => wrapper.find('.puik-alert__close')
const findButtonLeftIcon = () =>
wrapper.find('.puik-alert__button .puik-button__left-icon')
const findButtonRightIcon = () =>
wrapper.find('.puik-alert__button .puik-button__right-icon')

const factory = (
propsData: Record<string, any> = {},
Expand Down Expand Up @@ -47,6 +51,16 @@ describe('Alert tests', () => {
expect(wrapper.emitted('click')).toBeTruthy()
})

it('should display a button left icon', () => {
factory({ buttonLabel: 'Button', buttonLeftIcon: 'open_in_new' })
expect(findButtonLeftIcon().text()).toBe('open_in_new')
})

it('should display a button right icon', () => {
factory({ buttonLabel: 'Button', buttonRightIcon: 'open_in_new' })
expect(findButtonRightIcon().text()).toBe('open_in_new')
})

it('should display a title and a description', async () => {
factory({
title: faker.lorem.word(2),
Expand Down
Loading