From 5f737f96216d3d0b58cba96a52c82fe55a6e6a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20M=C3=A1rkus?= <23279421+mrksbnc@users.noreply.github.com> Date: Tue, 31 Dec 2024 21:18:59 +0100 Subject: [PATCH] fix: test updates (#294) --- .../bo_badge/__tests__/bo_badge.test.ts | 1 - .../bo_button/__test__/bo_button.test.ts | 51 ++++++++++--------- .../__tests__/bo_loading_spinner.test.ts | 2 +- .../bo_text/__tests__/bo_text.test.ts | 6 +-- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/components/bo_badge/__tests__/bo_badge.test.ts b/src/components/bo_badge/__tests__/bo_badge.test.ts index cd04b69..318fada 100644 --- a/src/components/bo_badge/__tests__/bo_badge.test.ts +++ b/src/components/bo_badge/__tests__/bo_badge.test.ts @@ -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') }) diff --git a/src/components/bo_button/__test__/bo_button.test.ts b/src/components/bo_button/__test__/bo_button.test.ts index 7535fcb..fab9426 100644 --- a/src/components/bo_button/__test__/bo_button.test.ts +++ b/src/components/bo_button/__test__/bo_button.test.ts @@ -132,7 +132,7 @@ 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') }) @@ -140,7 +140,7 @@ describe('bo_button.vue', () => { 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') }) @@ -148,7 +148,7 @@ describe('bo_button.vue', () => { 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') }) @@ -156,7 +156,7 @@ describe('bo_button.vue', () => { 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') }) @@ -164,7 +164,7 @@ describe('bo_button.vue', () => { 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') }) @@ -172,7 +172,7 @@ describe('bo_button.vue', () => { 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') }) @@ -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') }) @@ -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]') }) }) @@ -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 () => { @@ -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') }) }) @@ -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 () => { diff --git a/src/components/bo_loading_spinner/__tests__/bo_loading_spinner.test.ts b/src/components/bo_loading_spinner/__tests__/bo_loading_spinner.test.ts index a16fb9e..c3853cf 100644 --- a/src/components/bo_loading_spinner/__tests__/bo_loading_spinner.test.ts +++ b/src/components/bo_loading_spinner/__tests__/bo_loading_spinner.test.ts @@ -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', () => { diff --git a/src/components/bo_text/__tests__/bo_text.test.ts b/src/components/bo_text/__tests__/bo_text.test.ts index 7e997e0..7ec2c16 100644 --- a/src/components/bo_text/__tests__/bo_text.test.ts +++ b/src/components/bo_text/__tests__/bo_text.test.ts @@ -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 () => { @@ -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 () => {