-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from storybooks/new-test
add tests for decorator
- Loading branch information
Showing
9 changed files
with
296 additions
and
225 deletions.
There are no files selected for viewing
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
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,46 +1,45 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
const Component = () => <div /> | ||
const Component = () => <div />; | ||
const Simple = props => ( | ||
<div> | ||
<span>Hello</span> | ||
{props.children} | ||
</div> | ||
) | ||
); | ||
|
||
export default () => | ||
storiesOf('Children Array', module) | ||
.addWithJSX( | ||
'Simple Array', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
</div> | ||
), | ||
{ skip: 1 }, | ||
) | ||
.addWithJSX( | ||
'Array with function', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
{Component()} | ||
</div> | ||
), | ||
{ skip: 1 }, | ||
) | ||
.addWithJSX( | ||
'Array with nested component', | ||
() => ( | ||
<div> | ||
<div /> | ||
<Simple> | ||
<span>hello</span> | ||
</Simple> | ||
</div> | ||
), | ||
{ skip: 1 }, | ||
) | ||
storiesOf('Children Array', module) | ||
.addWithJSX( | ||
'Simple Array', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
</div> | ||
), | ||
{ skip: 1 } | ||
) | ||
.addWithJSX( | ||
'Array with function', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
{Component()} | ||
</div> | ||
), | ||
{ skip: 1 } | ||
) | ||
.addWithJSX( | ||
'Array with nested component', | ||
() => ( | ||
<div> | ||
<div /> | ||
<Simple> | ||
<span>hello</span> | ||
</Simple> | ||
</div> | ||
), | ||
{ skip: 1 } | ||
); |
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,47 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { jsxDecorator } from '../../lib/index'; | ||
|
||
const Component = () => <div />; | ||
const Simple = props => ( | ||
<div> | ||
<span>Hello</span> | ||
{props.children} | ||
</div> | ||
); | ||
|
||
storiesOf('Decorator', module) | ||
.addDecorator(jsxDecorator) | ||
.addWithJSX( | ||
'Simple Array', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
</div> | ||
), | ||
{ skip: 1 } | ||
) | ||
.addWithJSX( | ||
'Array with function', | ||
() => ( | ||
<div> | ||
<div /> | ||
<div /> | ||
{Component()} | ||
</div> | ||
), | ||
{ skip: 1 } | ||
) | ||
.addWithJSX( | ||
'Array with nested component', | ||
() => ( | ||
<div> | ||
<div /> | ||
<Simple> | ||
<span>hello</span> | ||
</Simple> | ||
</div> | ||
), | ||
{ skip: 1 } | ||
); |
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
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
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,17 +1,9 @@ | ||
import React from 'react'; | ||
import { setAddon } from '@storybook/react'; | ||
import JSXAddon from '../../lib/index'; | ||
|
||
import SimpleStories from './simple'; | ||
import DeepStories from './deep'; | ||
import FunctionStories from './functions'; | ||
import ArrayStories from './array'; | ||
import WithPropsStories from './withProps'; | ||
|
||
setAddon(JSXAddon); | ||
|
||
SimpleStories(); | ||
DeepStories(); | ||
FunctionStories(); | ||
ArrayStories(); | ||
WithPropsStories(); | ||
import './simple'; | ||
import './deep'; | ||
import './decorator'; | ||
import './functions'; | ||
import './array'; | ||
import './withProps'; |
Oops, something went wrong.