-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use composestories instead of story (#556)
- Loading branch information
Showing
12 changed files
with
52 additions
and
56 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ActionExample/Actions.test.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
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/BackgroundExample/BackgroundCsf.test.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
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Array/Array.test.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic } from './Array.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as ArrayStories from './Array.stories'; | ||
|
||
const ArrayStory = composeStory(Basic, Meta); | ||
const { Basic } = composeStories(ArrayStories); | ||
|
||
test('array story renders', () => { | ||
render(<ArrayStory />); | ||
render(<Basic />); | ||
|
||
expect(screen.getByTestId('array-story-container')).toHaveTextContent(/abc/); | ||
}); |
11 changes: 5 additions & 6 deletions
11
examples/expo-example/components/ControlExamples/Boolean/Boolean.test.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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic, On } from './Boolean.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as BooleanStories from './Boolean.stories'; | ||
|
||
const BooleanStory = composeStory(Basic, Meta); | ||
const OnStory = composeStory(On, Meta); | ||
const { Basic, On } = composeStories(BooleanStories); | ||
|
||
test('boolean story renders', () => { | ||
render(<BooleanStory />); | ||
render(<Basic />); | ||
|
||
screen.getByText('off'); | ||
}); | ||
|
||
test('boolean story renders on', () => { | ||
render(<OnStory />); | ||
render(<On />); | ||
|
||
screen.getByText('on'); | ||
}); |
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Color/Color.test.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { ColorExample } from './Color.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as Color from './Color.stories'; | ||
|
||
const ColorStory = composeStory(ColorExample, Meta); | ||
const { ColorExample } = composeStories(Color); | ||
|
||
test('color story renders', () => { | ||
render(<ColorStory />); | ||
render(<ColorExample />); | ||
|
||
expect(screen.getByTestId('color-story-container')).toHaveStyle({ backgroundColor: '#a819b9' }); | ||
}); |
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Date/Date.test.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
11 changes: 5 additions & 6 deletions
11
examples/expo-example/components/ControlExamples/Number/Number.test.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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic, Range } from './Number.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as NumberStories from './Number.stories'; | ||
|
||
const BasicStory = composeStory(Basic, Meta); | ||
const RangeStory = composeStory(Range, Meta); | ||
const { Basic, Range } = composeStories(NumberStories); | ||
|
||
test('basic story renders', async () => { | ||
render(<BasicStory />); | ||
render(<Basic />); | ||
|
||
await screen.findByText(/5 x 3 = 15/); | ||
}); | ||
|
||
test('range story renders', async () => { | ||
render(<RangeStory />); | ||
render(<Range />); | ||
|
||
await screen.findByText(/6 x 7 = 42/); | ||
}); |
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Object/Object.test.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
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Radio/Radio.test.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic } from './Radio.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as RadioStories from './Radio.stories'; | ||
|
||
const RadioStory = composeStory(Basic, Meta); | ||
const { Basic } = composeStories(RadioStories); | ||
|
||
test('radio story renders', () => { | ||
render(<RadioStory />); | ||
render(<Basic />); | ||
|
||
screen.getByText('104.8MHz'); | ||
}); |
14 changes: 6 additions & 8 deletions
14
examples/expo-example/components/ControlExamples/Select/Select.test.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 |
---|---|---|
@@ -1,25 +1,23 @@ | ||
import { screen, render } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic, WithLabels, WithMapping } from './Select.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as SelectStories from './Select.stories'; | ||
|
||
const SelectStory = composeStory(Basic, Meta); | ||
const SelectWithLabelsStory = composeStory(WithLabels, Meta); | ||
const SelectWithMappingStory = composeStory(WithMapping, Meta); | ||
const { Basic, WithLabels, WithMapping } = composeStories(SelectStories); | ||
|
||
test('select story renders', () => { | ||
render(<SelectStory />); | ||
render(<Basic />); | ||
|
||
screen.getByText('Selected: ⬅️'); | ||
}); | ||
|
||
test('select with labels story renders', () => { | ||
render(<SelectWithLabelsStory />); | ||
render(<WithLabels />); | ||
|
||
screen.getByText('Selected: ⬆'); | ||
}); | ||
|
||
test('select with mapping story renders', () => { | ||
render(<SelectWithMappingStory />); | ||
render(<WithMapping />); | ||
|
||
screen.getByText('Selected: ⬆'); | ||
}); |
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/ControlExamples/Text/Text.test.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { screen, render } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic } from './Text.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as TextStories from './Text.stories'; | ||
|
||
const TextStory = composeStory(Basic, Meta); | ||
const { Basic } = composeStories(TextStories); | ||
|
||
test('text story renders', () => { | ||
render(<TextStory />); | ||
render(<Basic />); | ||
|
||
screen.getByText('Hello world!'); | ||
}); |
8 changes: 4 additions & 4 deletions
8
examples/expo-example/components/InputExample/TextInput.test.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { render, screen } from '@testing-library/react-native'; | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { Basic } from './TextInput.stories'; | ||
import { composeStories } from '@storybook/react'; | ||
import * as InputStories from './TextInput.stories'; | ||
|
||
const TextInputStory = composeStory(Basic, Meta); | ||
const { Basic } = composeStories(InputStories); | ||
|
||
test('text input story renders', () => { | ||
render(<TextInputStory />); | ||
render(<Basic />); | ||
|
||
screen.getByPlaceholderText('Type something'); | ||
}); |