From c7f68c70620847c68836558ba073c7c1faa09900 Mon Sep 17 00:00:00 2001 From: Santiago Balladares <744091+santiagoballadares@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:24:08 +0200 Subject: [PATCH] test(kt-accordion): add snapshot test --- .../__snapshots__/ktAccordion.test.ts.snap | 95 +++++++++++++++++++ .../kotti-accordion/ktAccordion.test.ts | 27 ++++++ 2 files changed, 122 insertions(+) create mode 100644 packages/kotti-ui/source/kotti-accordion/__snapshots__/ktAccordion.test.ts.snap create mode 100644 packages/kotti-ui/source/kotti-accordion/ktAccordion.test.ts diff --git a/packages/kotti-ui/source/kotti-accordion/__snapshots__/ktAccordion.test.ts.snap b/packages/kotti-ui/source/kotti-accordion/__snapshots__/ktAccordion.test.ts.snap new file mode 100644 index 0000000000..d590f44431 --- /dev/null +++ b/packages/kotti-ui/source/kotti-accordion/__snapshots__/ktAccordion.test.ts.snap @@ -0,0 +1,95 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`KtAccordion.vue > renders correctly (with props) 1`] = ` +
+
+
+ + bookmark + +
+ My Accordion +
+
+
+ + plus + +
+
+
+
+
+
+`; + +exports[`KtAccordion.vue > renders correctly 1`] = ` +
+
+
+ +
+
+
+ + minus + +
+
+
+
+
+
+`; diff --git a/packages/kotti-ui/source/kotti-accordion/ktAccordion.test.ts b/packages/kotti-ui/source/kotti-accordion/ktAccordion.test.ts new file mode 100644 index 0000000000..bc26d7d6da --- /dev/null +++ b/packages/kotti-ui/source/kotti-accordion/ktAccordion.test.ts @@ -0,0 +1,27 @@ +import { shallowMount } from '@vue/test-utils' +import { describe, expect, it } from 'vitest' +import KtAccordion from './KtAccordion.vue' +import { Yoco } from '@3yourmind/yoco' + +describe('KtAccordion.vue', () => { + it('renders correctly', () => { + // @ts-expect-error mount type is not compatible with return type from defineComponent + const wrapper = shallowMount(KtAccordion) + + expect(wrapper.element).toMatchSnapshot() + }) + + it('renders correctly (with props)', () => { + // @ts-expect-error mount type is not compatible with return type from defineComponent + const wrapper = shallowMount(KtAccordion, { + propsData: { + dataTest: 'my-accordion', + icon: Yoco.Icon.BOOKMARK, + isClosed: true, + title: 'My Accordion', + }, + }) + + expect(wrapper.element).toMatchSnapshot() + }) +})