forked from epicmaxco/vuestic-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,48 @@ | ||
import { defineComponent } from 'vue' | ||
import VaInput from './VaInput.demo.vue' | ||
import VaInputDemo from './VaInput.demo.vue' | ||
import { VaInput } from './' | ||
import { expect } from '@storybook/jest' | ||
import type { StoryFn } from '@storybook/vue3' | ||
|
||
export default { | ||
title: 'VaInput', | ||
component: VaInput, | ||
} | ||
|
||
export const Default = defineComponent({ | ||
components: { VaInputDemo }, | ||
template: '<VaInputDemo />', | ||
}) | ||
|
||
export const Disabled: StoryFn = () => ({ | ||
components: { VaInput }, | ||
template: '<VaInput disabled/>', | ||
}) | ||
Disabled.play = async ({ canvasElement, step }) => { | ||
const input = canvasElement.querySelector('input') | ||
|
||
expect(input).toHaveAttribute('disabled') | ||
const vaInput = canvasElement.querySelector('.va-input') | ||
|
||
expect(vaInput).toHaveClass('va-input-wrapper--disabled') | ||
} | ||
|
||
export const Placeholder: StoryFn = () => ({ | ||
components: { VaInput }, | ||
template: '<VaInput/>', | ||
template: '<VaInput placeholder="Placeholder"/>', | ||
}) | ||
Placeholder.play = async ({ canvasElement, step }) => { | ||
const input = canvasElement.querySelector('input') | ||
|
||
expect(input).toHaveAttribute('placeholder', 'Placeholder') | ||
} | ||
|
||
export const Autofocus: StoryFn = () => ({ | ||
components: { VaInput }, | ||
template: '<VaInput autofocus />', | ||
}) | ||
Autofocus.play = async ({ canvasElement }) => { | ||
const input = canvasElement.querySelector('input') | ||
|
||
expect(input).toHaveFocus() | ||
} |
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