Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 2435e54

Browse files
author
yannbf@gmail.com
committed
Update CHANGELOG.md [skip ci]
1 parent e263e32 commit 2435e54

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
1+
# v0.0.19 (Thu Jul 15 2021)
2+
3+
### Release Notes
4+
5+
#### feat: support CSF3 format ([#37](https://github.com/storybookjs/testing-react/pull/37))
6+
7+
### Features
8+
9+
Storybook released [CSF3](https://storybook.js.org/blog/component-story-format-3-0/), where the story can also be an object. This is now supported in @storybook/testing-react. CSF3 also brings a new function called `play`, where you can write automated interactions to the story.
10+
11+
In @storybook/testing-react, the `play` does not run automatically for you, but rather comes in the returned component, and you can execute it as you please.
12+
13+
Consider the following example:
14+
15+
```tsx
16+
export const InputFieldFilled: Story<InputFieldProps> = {
17+
play: async () => {
18+
await userEvent.type(screen.getByRole('textbox'), 'Hello world!');
19+
},
20+
};
21+
```
22+
23+
You can use the play function like this:
24+
25+
```tsx
26+
const { InputFieldFilled } = composeStories(stories);
27+
28+
test('renders with play function', async () => {
29+
render(<InputFieldFilled />);
30+
31+
// play an interaction that fills the input
32+
await InputFieldFilled.play!();
33+
34+
const input = screen.getByRole('textbox') as HTMLInputElement;
35+
expect(input.value).toEqual('Hello world!');
36+
});
37+
```
38+
39+
---
40+
41+
#### 🐛 Bug Fix
42+
43+
- feat: support CSF3 format [#37](https://github.com/storybookjs/testing-react/pull/37) ([@yannbf](https://github.com/yannbf))
44+
45+
#### Authors: 1
46+
47+
- Yann Braga ([@yannbf](https://github.com/yannbf))
48+
49+
---
50+
151
# v0.0.18 (Fri Jun 25 2021)
252

353
#### 🐛 Bug Fix

0 commit comments

Comments
 (0)