Skip to content

Commit f1b2d2c

Browse files
authored
chore: use composestories instead of story (storybookjs#556)
1 parent 10228df commit f1b2d2c

File tree

12 files changed

+52
-56
lines changed

12 files changed

+52
-56
lines changed

examples/expo-example/components/ActionExample/Actions.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { render, screen, userEvent } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Actions.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as Actions from './Actions.stories';
44

5-
const ActionsStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(Actions);
66

77
test('action story renders and onpress works', async () => {
88
jest.useFakeTimers();
99

1010
const onPress = jest.fn();
1111

12-
render(<ActionsStory onPress={onPress} />);
12+
render(<Basic onPress={onPress} />);
1313

1414
const user = userEvent.setup({});
1515

examples/expo-example/components/BackgroundExample/BackgroundCsf.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import '@testing-library/react-native/extend-expect';
22
import { render, screen } from '@testing-library/react-native';
3-
import { composeStory } from '@storybook/react';
4-
import Meta, { Basic } from './BackgroundCsf.stories';
3+
import { composeStories } from '@storybook/react';
4+
import * as Backgrounds from './BackgroundCsf.stories';
55

6-
const BackgroundCsfStory = composeStory(Basic, Meta);
6+
const { Basic } = composeStories(Backgrounds);
77

88
test('Background colour is hotpink', () => {
9-
render(<BackgroundCsfStory />);
9+
render(<Basic />);
1010

1111
expect(screen.getByTestId('addon-backgrounds-container')).toHaveStyle({
1212
backgroundColor: 'hotpink',
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Array.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as ArrayStories from './Array.stories';
44

5-
const ArrayStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(ArrayStories);
66

77
test('array story renders', () => {
8-
render(<ArrayStory />);
8+
render(<Basic />);
99

1010
expect(screen.getByTestId('array-story-container')).toHaveTextContent(/abc/);
1111
});
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic, On } from './Boolean.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as BooleanStories from './Boolean.stories';
44

5-
const BooleanStory = composeStory(Basic, Meta);
6-
const OnStory = composeStory(On, Meta);
5+
const { Basic, On } = composeStories(BooleanStories);
76

87
test('boolean story renders', () => {
9-
render(<BooleanStory />);
8+
render(<Basic />);
109

1110
screen.getByText('off');
1211
});
1312

1413
test('boolean story renders on', () => {
15-
render(<OnStory />);
14+
render(<On />);
1615

1716
screen.getByText('on');
1817
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { ColorExample } from './Color.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as Color from './Color.stories';
44

5-
const ColorStory = composeStory(ColorExample, Meta);
5+
const { ColorExample } = composeStories(Color);
66

77
test('color story renders', () => {
8-
render(<ColorStory />);
8+
render(<ColorExample />);
99

1010
expect(screen.getByTestId('color-story-container')).toHaveStyle({ backgroundColor: '#a819b9' });
1111
});

examples/expo-example/components/ControlExamples/Date/Date.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Date.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as DateStories from './Date.stories';
44

5-
const DateStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(DateStories);
66

77
test('date story renders', () => {
8-
render(<DateStory />);
8+
render(<Basic />);
99

1010
const date = new Date(1983, 1, 25);
1111

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic, Range } from './Number.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as NumberStories from './Number.stories';
44

5-
const BasicStory = composeStory(Basic, Meta);
6-
const RangeStory = composeStory(Range, Meta);
5+
const { Basic, Range } = composeStories(NumberStories);
76

87
test('basic story renders', async () => {
9-
render(<BasicStory />);
8+
render(<Basic />);
109

1110
await screen.findByText(/5 x 3 = 15/);
1211
});
1312

1413
test('range story renders', async () => {
15-
render(<RangeStory />);
14+
render(<Range />);
1615

1716
await screen.findByText(/6 x 7 = 42/);
1817
});

examples/expo-example/components/ControlExamples/Object/Object.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Object.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as ObjectStory from './Object.stories';
44

5-
const ObjectStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(ObjectStory);
66

77
test('object story renders', () => {
8-
render(<ObjectStory />);
8+
render(<Basic />);
99

1010
screen.getByText('title: Blade Runner');
1111
screen.getByText('genre: Sci Fi');
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Radio.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as RadioStories from './Radio.stories';
44

5-
const RadioStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(RadioStories);
66

77
test('radio story renders', () => {
8-
render(<RadioStory />);
8+
render(<Basic />);
99

1010
screen.getByText('104.8MHz');
1111
});
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
import { screen, render } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic, WithLabels, WithMapping } from './Select.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as SelectStories from './Select.stories';
44

5-
const SelectStory = composeStory(Basic, Meta);
6-
const SelectWithLabelsStory = composeStory(WithLabels, Meta);
7-
const SelectWithMappingStory = composeStory(WithMapping, Meta);
5+
const { Basic, WithLabels, WithMapping } = composeStories(SelectStories);
86

97
test('select story renders', () => {
10-
render(<SelectStory />);
8+
render(<Basic />);
119

1210
screen.getByText('Selected: ⬅️');
1311
});
1412

1513
test('select with labels story renders', () => {
16-
render(<SelectWithLabelsStory />);
14+
render(<WithLabels />);
1715

1816
screen.getByText('Selected: ⬆');
1917
});
2018

2119
test('select with mapping story renders', () => {
22-
render(<SelectWithMappingStory />);
20+
render(<WithMapping />);
2321

2422
screen.getByText('Selected: ⬆');
2523
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { screen, render } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './Text.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as TextStories from './Text.stories';
44

5-
const TextStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(TextStories);
66

77
test('text story renders', () => {
8-
render(<TextStory />);
8+
render(<Basic />);
99

1010
screen.getByText('Hello world!');
1111
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { render, screen } from '@testing-library/react-native';
2-
import { composeStory } from '@storybook/react';
3-
import Meta, { Basic } from './TextInput.stories';
2+
import { composeStories } from '@storybook/react';
3+
import * as InputStories from './TextInput.stories';
44

5-
const TextInputStory = composeStory(Basic, Meta);
5+
const { Basic } = composeStories(InputStories);
66

77
test('text input story renders', () => {
8-
render(<TextInputStory />);
8+
render(<Basic />);
99

1010
screen.getByPlaceholderText('Type something');
1111
});

0 commit comments

Comments
 (0)