-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(documentation-v7): migrate snapshot test for collapsible (#1823)
- Loading branch information
1 parent
c1dee3b
commit ee91d41
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/documentation-v7/cypress/snapshots/components/collapsible.snapshot.ts
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,7 @@ | ||
describe('Collapsible', () => { | ||
it('default', () => { | ||
cy.visit('/iframe.html?id=snapshots--collapsible'); | ||
cy.get('post-collapsible.hydrated').should('be.visible'); | ||
cy.percySnapshot('Collapsible'); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
...ages/documentation-v7/src/stories/components/collapsible/collapsible.snapshot.stories.tsx
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,41 @@ | ||
import { html } from 'lit'; | ||
import type { Args, StoryContext, StoryObj } from '@storybook/web-components'; | ||
import { bombArgs } from '../../../utils/bombArgs'; | ||
|
||
import meta, { Default } from './collapsible.stories'; | ||
|
||
export default { | ||
...meta, | ||
title: 'Snapshots', | ||
}; | ||
|
||
type Story = StoryObj<HTMLPostCollapsibleElement>; | ||
|
||
export const collapsible: Story = { | ||
render: (_args: Args, context: StoryContext<HTMLPostCollapsibleElement>) => { | ||
const templateVariants = bombArgs({ | ||
innerHTML: [ | ||
`<span slot="header">Titulum</span><p>Contentus momentus vero siteos et accusam iretea et justo.</p>`, | ||
`<p>Contentus momentus vero siteos et accusam iretea et justo.</p>`, | ||
], | ||
collapsed: [false, true], | ||
headingLevel: [1, 2, 3, 4, 5, 6], | ||
}).map((args: Args) => { | ||
return html` | ||
<div class="col-6 p-3"> | ||
${meta.render?.({ ...context.args, ...Default.args, ...args }, context)} | ||
</div> | ||
`; | ||
}); | ||
|
||
return html` | ||
<div> | ||
${['white', 'dark'].map( | ||
bg => html` | ||
<div class=${'row bg-' + bg}>${templateVariants}</div> | ||
`, | ||
)} | ||
</div> | ||
`; | ||
}, | ||
}; |