-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check element match snapshot instead of wrapper
- Loading branch information
Showing
9 changed files
with
347 additions
and
49,710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
declare module '*.svg?component' { | ||
const value: string; | ||
export default value; | ||
} | ||
} | ||
declare module '*.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49,961 changes: 256 additions & 49,705 deletions
49,961
src/components/Footer/__snapshots__/WFooter.spec.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { describe, it, expect } from 'vitest' | ||
import { h } from 'vue' | ||
import { mount } from '@vue/test-utils' | ||
import WSection from './WSection.vue' | ||
|
||
describe('WSection', () => { | ||
it('renders properly', () => { | ||
const wrapper = mount(WSection, { | ||
props: { | ||
frameClasses: 'bg-black-950', | ||
contentClasses: 'grid justify-items-center', | ||
}, | ||
slots: { | ||
content: h('p', 'Section content') | ||
} | ||
}) | ||
|
||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
// import { fn } from '@storybook/test'; | ||
import WSection from './WSection.vue' | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories | ||
const meta: any = { | ||
title: 'Example/WSection', | ||
component: WSection, | ||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
argTypes: { | ||
// type: { control: 'select', options: ['primary', 'secondary', 'arrow', 'dark'] } | ||
}, | ||
args: { | ||
// type: 'primary' | ||
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args | ||
// onClick: fn(), | ||
} | ||
} satisfies Meta<typeof WSection> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
/* | ||
*👇 Render functions are a framework specific feature to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
|
||
export const Section: Story = { | ||
render: (args: any) => ({ | ||
components: { WSection }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: `<WSection v-bind="args"> | ||
<template #content> | ||
<p class="text-white-50">Section content<p> | ||
</template> | ||
</WSection>` | ||
}), | ||
args: { | ||
frameClasses: 'bg-black-950', | ||
contentClasses: 'grid justify-items-center', | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/components/Section/__snapshots__/WSection.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`WSection > renders properly 1`] = ` | ||
<div | ||
class="w-full h-full bg-black-950" | ||
> | ||
<div | ||
class="content p-[100px] m-[0_auto] max-w-[1100px] w-full sm:p-[70px_32px] xs:p-[70px_16px] z-50 grid justify-items-center" | ||
> | ||
<p> | ||
Section content | ||
</p> | ||
</div> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters