Skip to content

Commit

Permalink
fix: test updates (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrksbnc authored Dec 31, 2024
1 parent b07abef commit 5f737f9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/components/bo_badge/__tests__/bo_badge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('bo_badge.vue', () => {
expect(wrapper.find('.bo-badge').classes()).contains('select-none')
expect(wrapper.find('.bo-badge').classes()).contains('font-bold')
expect(wrapper.find('.bo-badge').classes()).contains('font-graphik')
expect(wrapper.find('.bo-badge').classes()).contains('gap-2')
expect(wrapper.find('.bo-badge').classes()).contains('max-w-fit')
})

Expand Down
51 changes: 28 additions & 23 deletions src/components/bo_button/__test__/bo_button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,47 +132,47 @@ describe('bo_button.vue', () => {
test('primary button should have the correct color | background | focus classes', () => {
expect(wrapper.classes()).toContain('bg-blue-600')
expect(wrapper.classes()).toContain('hover:bg-blue-700')
expect(wrapper.classes()).toContain('focus:ring-blue-600')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

test('secondary button should have the correct color | background | focus classes', async () => {
await wrapper.setProps({ variant: BoButtonVariant.secondary })
expect(wrapper.classes()).toContain('bg-gray-400')
expect(wrapper.classes()).toContain('hover:bg-gray-700')
expect(wrapper.classes()).toContain('focus:ring-gray-400')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

test('danger button should have the correct color | background | focus classes', async () => {
await wrapper.setProps({ variant: BoButtonVariant.danger })
expect(wrapper.classes()).toContain('bg-red-600')
expect(wrapper.classes()).toContain('hover:bg-red-700')
expect(wrapper.classes()).toContain('focus:ring-red-600')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

test('warning button should have the correct color | background | focus classes', async () => {
await wrapper.setProps({ variant: BoButtonVariant.warning })
expect(wrapper.classes()).toContain('bg-yellow-500')
expect(wrapper.classes()).toContain('hover:bg-yellow-700')
expect(wrapper.classes()).toContain('focus:ring-yellow-500')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

test('success button should have the correct color | background | focus classes', async () => {
await wrapper.setProps({ variant: BoButtonVariant.success })
expect(wrapper.classes()).toContain('bg-green-600')
expect(wrapper.classes()).toContain('hover:bg-green-700')
expect(wrapper.classes()).toContain('focus:ring-green-600')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

test('dark button should have the correct color | background | focus classes', async () => {
await wrapper.setProps({ variant: BoButtonVariant.dark })
expect(wrapper.classes()).toContain('bg-black')
expect(wrapper.classes()).toContain('hover:bg-black/50')
expect(wrapper.classes()).toContain('focus:ring-black')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-white')
})

Expand All @@ -181,7 +181,7 @@ describe('bo_button.vue', () => {
expect(wrapper.classes()).toContain('bg-transparent')
expect(wrapper.classes()).toContain('hover:bg-transparent')
expect(wrapper.classes()).toContain('focus:ring-transparent')
expect(wrapper.classes()).toContain('text-blue-600')
expect(wrapper.classes()).toContain('text-blue-500')
expect(wrapper.classes()).toContain('hover:text-blue-700')
expect(wrapper.classes()).toContain('focus:ring-transparent')
})
Expand Down Expand Up @@ -253,38 +253,43 @@ describe('bo_button.vue', () => {
})

test('the button should have the correct default size classes', () => {
expect(wrapper.classes()).toContain('h-[40px]')
expect(wrapper.classes()).toContain('px-[24px]')
expect(wrapper.classes()).toContain('h-[32px]')
expect(wrapper.classes()).toContain('px-[12px]')
})

test('the button should have the correct size classes if a the size is extra small', async () => {
await wrapper.setProps({ size: BoSize.extra_small })
expect(wrapper.classes()).toContain('h-[24px]')
expect(wrapper.classes()).toContain('px-[8px]')

expect(wrapper.classes()).toContain('h-[16px]')
expect(wrapper.classes()).toContain('px-[4px]')
})

test('the button should have the correct size classes if a the size is small', async () => {
await wrapper.setProps({ size: BoSize.small })
expect(wrapper.classes()).toContain('h-[32px]')
expect(wrapper.classes()).toContain('px-[16px]')

expect(wrapper.classes()).toContain('h-[24px]')
expect(wrapper.classes()).toContain('px-[8px]')
})

test('the button should have the correct size classes if a the size is default', async () => {
await wrapper.setProps({ size: BoSize.default })
expect(wrapper.classes()).toContain('h-[40px]')
expect(wrapper.classes()).toContain('px-[24px]')

expect(wrapper.classes()).toContain('h-[32px]')
expect(wrapper.classes()).toContain('px-[12px]')
})

test('the button should have the correct size classes if a the size is large', async () => {
await wrapper.setProps({ size: BoSize.large })
expect(wrapper.classes()).toContain('h-[48px]')
expect(wrapper.classes()).toContain('px-[32px]')

expect(wrapper.classes()).toContain('h-[40px]')
expect(wrapper.classes()).toContain('px-[16px]')
})

test('the button should have the correct size classes if a the size is extra large', async () => {
await wrapper.setProps({ size: BoSize.extra_large })
expect(wrapper.classes()).toContain('h-[56px]')
expect(wrapper.classes()).toContain('px-[40px]')

expect(wrapper.classes()).toContain('h-[48px]')
expect(wrapper.classes()).toContain('px-[20px]')
})
})

Expand Down Expand Up @@ -335,11 +340,11 @@ describe('bo_button.vue', () => {
})

test('default button should have the correct shadow classes', () => {
expect(wrapper.classes()).toContain('shadow-md')
expect(wrapper.classes()).toContain('shadow-lg')
})

test('the button should have the correct shadow classes', () => {
expect(wrapper.classes()).toContain('shadow-md')
expect(wrapper.classes()).toContain('shadow-lg')
})

test('by default the link types buttton should not have a shadow', async () => {
Expand All @@ -349,7 +354,7 @@ describe('bo_button.vue', () => {

test('if the prop is set to true the link types buttton should have a shadow', async () => {
await wrapper.setProps({ linkVariantWithShadow: true })
expect(wrapper.classes()).toContain('shadow-md')
expect(wrapper.classes()).toContain('shadow-lg')
})
})

Expand Down Expand Up @@ -503,7 +508,7 @@ describe('bo_button.vue', () => {
test('the button should have the correct loader size if a different size is provided', async () => {
await wrapper.setProps({ size: BoSize.small })
const loader = wrapper.findComponent(BoLoadingSpinner)
expect(loader.props('size')).toBe(BoSize.small)
expect(loader.props('size')).toBe(BoSize.extra_small)
})

test('the button should be able to render a large loader', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('bo_loading_spinner.vue', () => {
expect(globalWrapper.classes()).toContain('content-center')
expect(globalWrapper.classes()).toContain('items-center')
expect(globalWrapper.classes()).toContain('justify-center')
expect(globalWrapper.classes()).toContain('gap-2')
expect(globalWrapper.classes()).toContain('gap-1')
})

test('the spinner animation should have the default classes', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/bo_text/__tests__/bo_text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('bo_text.vue', () => {

test('the text should have the correct default color classes with text color', async () => {
await wrapper.setProps({ color: BoTextColor.default })
expect(wrapper.find('#test-id').classes()).toContain('text-gray-900')
expect(wrapper.find('#test-id').classes()).toContain('text-neutral-900')
})

test('the text should have the correct current color classes', async () => {
Expand Down Expand Up @@ -250,12 +250,12 @@ describe('bo_text.vue', () => {

test('the text should have the correct secondary color classes', async () => {
await wrapper.setProps({ color: BoTextColor.secondary })
expect(wrapper.find('#test-id').classes()).toContain('text-gray-500')
expect(wrapper.find('#test-id').classes()).toContain('text-neutral-500')
})

test('the text should have the correct disabled color classes', async () => {
await wrapper.setProps({ color: BoTextColor.disabled })
expect(wrapper.find('#test-id').classes()).toContain('text-gray-400')
expect(wrapper.find('#test-id').classes()).toContain('text-neutral-400')
})

test('the text should have the correct info color classes', async () => {
Expand Down

0 comments on commit 5f737f9

Please sign in to comment.