From 1c49121098e23b12442ba01c31bf437b80bbfa97 Mon Sep 17 00:00:00 2001 From: tommytrg Date: Tue, 3 Sep 2024 12:16:31 +0200 Subject: [PATCH] f --- .../__snapshots__/WIconRounded.spec.ts.snap | 10 ++- .../__snapshots__/WIconText.spec.ts.snap | 5 +- .../__snapshots__/WSocialsBar.spec.ts.snap | 5 +- .../icon/__snapshots__/WIcon.spec.ts.snap | 1 + src/components/pagination/WPagination.spec.ts | 54 +++++++++++++ .../pagination/WPagination.stories.ts | 2 +- .../__snapshots__/WPagination.spec.ts.snap | 78 +++++++++++++++++++ 7 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 src/components/pagination/WPagination.spec.ts create mode 100644 src/components/pagination/__snapshots__/WPagination.spec.ts.snap diff --git a/src/components/IconRounded/__snapshots__/WIconRounded.spec.ts.snap b/src/components/IconRounded/__snapshots__/WIconRounded.spec.ts.snap index b11b041..2c7d51d 100644 --- a/src/components/IconRounded/__snapshots__/WIconRounded.spec.ts.snap +++ b/src/components/IconRounded/__snapshots__/WIconRounded.spec.ts.snap @@ -2,21 +2,27 @@ exports[`WIconRounded > renders properly 1`] = `
- + diff --git a/src/components/IconText/__snapshots__/WIconText.spec.ts.snap b/src/components/IconText/__snapshots__/WIconText.spec.ts.snap index 762b178..cae1a6b 100644 --- a/src/components/IconText/__snapshots__/WIconText.spec.ts.snap +++ b/src/components/IconText/__snapshots__/WIconText.spec.ts.snap @@ -40,11 +40,13 @@ exports[`WIconText > renders properly ROUNDED RIGHT 1`] = ` target="_blank" >
renders properly ROUNDED RIGHT 1`] = ` class="social-icon" clip-rule="evenodd" d="M18.54 0C19.896 0 21 1.104 21 2.472V24L18.42 21.72L16.968 20.376L15.432 18.948L16.068 21.168H2.46C1.104 21.168 0 20.064 0 18.696V2.472C0 1.104 1.104 0 2.46 0L18.54 0ZM13.908 15.672C16.56 15.588 17.58 13.848 17.58 13.848C17.58 9.984 15.852 6.852 15.852 6.852C14.124 5.556 12.48 5.592 12.48 5.592L12.312 5.784C14.352 6.408 15.3 7.308 15.3 7.308C14.052 6.624 12.828 6.288 11.688 6.156C10.824 6.06 9.996 6.084 9.264 6.18L9.06 6.204C8.64 6.24 7.62 6.396 6.336 6.96C5.892 7.164 5.628 7.308 5.628 7.308C5.628 7.308 6.624 6.36 8.784 5.736L8.664 5.592C8.664 5.592 7.02 5.556 5.292 6.852C5.292 6.852 3.564 9.984 3.564 13.848C3.564 13.848 4.572 15.588 7.224 15.672C7.224 15.672 7.668 15.132 8.028 14.676C6.504 14.22 5.928 13.26 5.928 13.26L6.264 13.464L6.312 13.5L6.359 13.527L6.373 13.533L6.42 13.56C6.72 13.728 7.02 13.86 7.296 13.968C7.788 14.16 8.376 14.352 9.06 14.484C9.96 14.652 11.016 14.712 12.168 14.496C12.732 14.4 13.308 14.232 13.908 13.98C14.328 13.824 14.796 13.596 15.288 13.272C15.288 13.272 14.688 14.256 13.116 14.7C13.476 15.156 13.908 15.672 13.908 15.672ZM8.328 10.068C7.644 10.068 7.104 10.668 7.104 11.4C7.104 12.132 7.656 12.732 8.328 12.732C9.012 12.732 9.552 12.132 9.552 11.4C9.564 10.668 9.012 10.068 8.328 10.068ZM12.708 10.068C12.024 10.068 11.484 10.668 11.484 11.4C11.484 12.132 12.036 12.732 12.708 12.732C13.392 12.732 13.932 12.132 13.932 11.4C13.932 10.668 13.392 10.068 12.708 10.068Z" + data-v-1216bb64-s="" fill="#ccc" fill-rule="evenodd" /> diff --git a/src/components/SocialsBar/__snapshots__/WSocialsBar.spec.ts.snap b/src/components/SocialsBar/__snapshots__/WSocialsBar.spec.ts.snap index 44b4fa5..d9ecd51 100644 --- a/src/components/SocialsBar/__snapshots__/WSocialsBar.spec.ts.snap +++ b/src/components/SocialsBar/__snapshots__/WSocialsBar.spec.ts.snap @@ -3,7 +3,6 @@ exports[`SocialsBar > renders properly 1`] = `
renders properly 1`] = ` renders properly 1`] = ` renders properly 1`] = ` renders properly 1`] = ` renders the specified svg 1`] = ` { + it('renders properly', () => { + const wrapper = mount(WPagination, { props: { total: 10, pageSize: 5, page: 1 } }) + + expect(wrapper.element).toMatchSnapshot() + }) + + it('click on page changes current page', async () => { + const wrapper = mount(WPagination, { props: { total: 10, pageSize: 5, page: 1 } }) + + const buttons = wrapper.findAll('button') + + expect(buttons[2].element.textContent).toBe('2') + + await buttons[2].trigger('click') + + const selected = wrapper.find('.bg-wit-blue-500') + + expect(selected.text()).toBe('2') + }) + + it('click on previous changes current page', async () => { + const wrapper = mount(WPagination, { props: { total: 10, pageSize: 5, page: 2 } }) + + const buttons = wrapper.findAll('button') + + expect(buttons[0].element.textContent).toBe('Previous') + + await buttons[0].trigger('click') + + const selected = wrapper.find('.bg-wit-blue-500') + + expect(selected.text()).toBe('1') + }) + + it('click on next changes current page', async () => { + const wrapper = mount(WPagination, { props: { total: 10, pageSize: 5, page: 1 } }) + + const buttons = wrapper.findAll('button') + + expect(buttons[3].element.textContent).toBe('Next') + + await buttons[3].trigger('click') + + const selected = wrapper.find('.bg-wit-blue-500') + + expect(selected.text()).toBe('2') + }) +}) diff --git a/src/components/pagination/WPagination.stories.ts b/src/components/pagination/WPagination.stories.ts index bf60602..c431940 100644 --- a/src/components/pagination/WPagination.stories.ts +++ b/src/components/pagination/WPagination.stories.ts @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from '@storybook/vue3' -import { ref, watch } from 'vue' +import { ref } from 'vue' import WPagination from './WPagination.vue' const meta = { diff --git a/src/components/pagination/__snapshots__/WPagination.spec.ts.snap b/src/components/pagination/__snapshots__/WPagination.spec.ts.snap new file mode 100644 index 0000000..3c4666b --- /dev/null +++ b/src/components/pagination/__snapshots__/WPagination.spec.ts.snap @@ -0,0 +1,78 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`WPagination > renders properly 1`] = ` + + Previous + + +
+ + + + +
+ + +`;