mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
test: support e2e in storybook (#1533)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
|
||||
import type { Meta, StoryFn } from '@storybook/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Button } from '..';
|
||||
import type { ButtonProps } from '../ui/button/interface';
|
||||
@@ -44,3 +45,27 @@ Danger.args = {
|
||||
type: 'danger',
|
||||
children: 'This is a danger button',
|
||||
};
|
||||
|
||||
export const Test: StoryFn<ButtonProps> = () => {
|
||||
const [input, setInput] = useState('');
|
||||
return (
|
||||
<>
|
||||
<input
|
||||
type="text"
|
||||
data-testid="test-input"
|
||||
value={input}
|
||||
onChange={e => setInput(e.target.value)}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setInput('');
|
||||
}}
|
||||
data-testid="clear-button"
|
||||
>
|
||||
clear
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Test.storyName = 'Click Test';
|
||||
|
||||
Reference in New Issue
Block a user