-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: Fix various storiesof-to-csf cases based on chromatic stor… (#9013)
CLI: Fix various storiesof-to-csf cases based on chromatic stories upgrade
- Loading branch information
Showing
11 changed files
with
199 additions
and
6 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-destructuring.input.js
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import ComponentRow from './ComponentRow'; | ||
import * as SpecRowStories from './SpecRow.stories'; | ||
|
||
export const { actions } = SpecRowStories; | ||
|
||
storiesOf('ComponentRow', module).add('pending', () => ( | ||
<ComponentRow snapshots={snapshots.pending} buildNumber={2} {...actions} /> | ||
)); |
23 changes: 23 additions & 0 deletions
23
...mod/src/transforms/__testfixtures__/storiesof-to-csf/export-destructuring.output.snapshot
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "export-destructuring.input.js" data 1`] = ` | ||
"/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import ComponentRow from './ComponentRow'; | ||
import * as SpecRowStories from './SpecRow.stories'; | ||
|
||
export const { actions } = SpecRowStories; | ||
|
||
export default { | ||
title: 'ComponentRow', | ||
excludeStories: ['actions'], | ||
}; | ||
|
||
export const Pending = () => ( | ||
<ComponentRow snapshots={snapshots.pending} buildNumber={2} {...actions} /> | ||
); | ||
|
||
Pending.story = { | ||
name: 'pending', | ||
};" | ||
`; |
12 changes: 12 additions & 0 deletions
12
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-function.input.js
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import ComponentItem from './ComponentItem'; | ||
|
||
export function someHelper() { | ||
return 5; | ||
} | ||
|
||
storiesOf('ComponentItem', module) | ||
.addDecorator(storyFn => <div style={{ margin: '1rem' }}>{storyFn()}</div>) | ||
.add('loading', () => <ComponentItem loading />); |
23 changes: 23 additions & 0 deletions
23
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-function.output.snapshot
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "export-function.input.js" data 1`] = ` | ||
"/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import ComponentItem from './ComponentItem'; | ||
|
||
export function someHelper() { | ||
return 5; | ||
} | ||
|
||
export default { | ||
title: 'ComponentItem', | ||
decorators: [storyFn => <div style={{ margin: '1rem' }}>{storyFn()}</div>], | ||
excludeStories: ['someHelper'], | ||
}; | ||
|
||
export const Loading = () => <ComponentItem loading />; | ||
|
||
Loading.story = { | ||
name: 'loading', | ||
};" | ||
`; |
14 changes: 14 additions & 0 deletions
14
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-names.input.js
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import FlexCenter from './FlexCenter'; | ||
import { specs, urls } from './LiveView.stories'; | ||
import { ignoredRegions } from './IgnoredRegions.stories'; | ||
|
||
export { specs, urls, ignoredRegions }; | ||
|
||
storiesOf('FlexCenter', module).add('2:1', () => ( | ||
<FlexCenter width={200} height={100} style={{ background: 'papayawhip' }}> | ||
<div style={{ padding: 30, background: 'hotpink' }}>2:1</div> | ||
</FlexCenter> | ||
)); |
26 changes: 26 additions & 0 deletions
26
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/export-names.output.snapshot
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "export-names.input.js" data 1`] = ` | ||
"/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import FlexCenter from './FlexCenter'; | ||
import { specs, urls } from './LiveView.stories'; | ||
import { ignoredRegions } from './IgnoredRegions.stories'; | ||
|
||
export { specs, urls, ignoredRegions }; | ||
|
||
export default { | ||
title: 'FlexCenter', | ||
excludeStories: ['specs', 'urls', 'ignoredRegions'], | ||
}; | ||
|
||
export const _21 = () => ( | ||
<FlexCenter width={200} height={100} style={{ background: 'papayawhip' }}> | ||
<div style={{ padding: 30, background: 'hotpink' }}>2:1</div> | ||
</FlexCenter> | ||
); | ||
|
||
_21.story = { | ||
name: '2:1', | ||
};" | ||
`; |
8 changes: 8 additions & 0 deletions
8
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/parameters-as-var.input.js
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import Canvas from './Canvas'; | ||
|
||
const CHROMATIC_DELAY = { chromatic: { delay: 500 } }; | ||
|
||
storiesOf('Canvas', module).add('loading', () => <Canvas loading />, CHROMATIC_DELAY); |
20 changes: 20 additions & 0 deletions
20
...odemod/src/transforms/__testfixtures__/storiesof-to-csf/parameters-as-var.output.snapshot
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "parameters-as-var.input.js" data 1`] = ` | ||
"/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import Canvas from './Canvas'; | ||
|
||
const CHROMATIC_DELAY = { chromatic: { delay: 500 } }; | ||
|
||
export default { | ||
title: 'Canvas', | ||
}; | ||
|
||
export const Loading = () => <Canvas loading />; | ||
|
||
Loading.story = { | ||
name: 'loading', | ||
parameters: CHROMATIC_DELAY, | ||
};" | ||
`; |
11 changes: 11 additions & 0 deletions
11
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/storiesof-var.input.js
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import Hero from './Hero'; | ||
|
||
const chapter = storiesOf('Webapp screens/Marketing/LandingScreen/Hero', module).add( | ||
'default', | ||
() => <Hero /> | ||
); | ||
|
||
chapter.add('loading', () => <Hero loading />); |
23 changes: 23 additions & 0 deletions
23
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/storiesof-var.output.snapshot
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "storiesof-var.input.js" data 1`] = ` | ||
"/* eslint-disable import/no-extraneous-dependencies */ | ||
import React from 'react'; | ||
import Hero from './Hero'; | ||
|
||
export default { | ||
title: 'Webapp screens/Marketing/LandingScreen/Hero', | ||
}; | ||
|
||
export const Default = () => <Hero />; | ||
|
||
Default.story = { | ||
name: 'default', | ||
}; | ||
|
||
export const Loading = () => <Hero loading />; | ||
|
||
Loading.story = { | ||
name: 'loading', | ||
};" | ||
`; |
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