-
Notifications
You must be signed in to change notification settings - Fork 430
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 #2401 from steemit/im/2182/more-storybooks
More Component Stories and init component file-structure.
- Loading branch information
Showing
19 changed files
with
344 additions
and
8 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
55 changes: 55 additions & 0 deletions
55
src/app/components/elements/Author/__snapshots__/spec.js.snap
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,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Author /> renders without crashing 1`] = ` | ||
ShallowWrapper { | ||
"length": 1, | ||
Symbol(enzyme.__root__): [Circular], | ||
Symbol(enzyme.__unrendered__): <Provider | ||
store={ | ||
Object { | ||
"dispatch": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
Symbol(observable): [Function], | ||
} | ||
} | ||
> | ||
<Connect(Author) /> | ||
</Provider>, | ||
Symbol(enzyme.__renderer__): Object { | ||
"batchedUpdates": [Function], | ||
"getNode": [Function], | ||
"render": [Function], | ||
"simulateEvent": [Function], | ||
"unmount": [Function], | ||
}, | ||
Symbol(enzyme.__node__): Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object {}, | ||
"ref": null, | ||
"rendered": null, | ||
"type": [Function], | ||
}, | ||
Symbol(enzyme.__nodes__): Array [ | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object {}, | ||
"ref": null, | ||
"rendered": null, | ||
"type": [Function], | ||
}, | ||
], | ||
Symbol(enzyme.__options__): Object { | ||
"adapter": ReactFifteenAdapter { | ||
"options": Object { | ||
"supportPrevContextArgumentOfComponentDidUpdate": true, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Author from './index'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { configure, shallow } from 'enzyme'; | ||
|
||
import Adapter from 'enzyme-adapter-react-15'; | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
const store = createStore(rootReducer); | ||
|
||
describe('<Author />', () => { | ||
const wrapper = shallow( | ||
<Provider store={store}> | ||
<Author /> | ||
</Provider> | ||
); | ||
const container = wrapper.instance(); | ||
|
||
it('renders without crashing', () => { | ||
expect(wrapper).toBeTruthy(); | ||
expect(container).toBeTruthy(); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
File renamed without changes.
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,24 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import ChangePassword from './ChangePassword'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('ChangePassword', () => ( | ||
<Center> | ||
<ChangePassword | ||
username={'maitland'} | ||
defaultPassword={'password1'} | ||
authType={null} | ||
priorAuthKey={'posting'} // Required pubkey if authType is given | ||
/> | ||
</Center> | ||
)); |
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 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Follow from './index'; | ||
import { Center } from '../Tooltip.story'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('Follow', () => ( | ||
<Center> | ||
<Follow | ||
className="float-right" | ||
follower={'maitland'} | ||
following={'Carol'} | ||
what="blog" | ||
showFollow={boolean('Show Follow?', true)} | ||
showMute={boolean('Show Mute?', true)} | ||
/> | ||
</Center> | ||
)); |
55 changes: 55 additions & 0 deletions
55
src/app/components/elements/Follow/__snapshots__/spec.js.snap
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,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Follow /> renders without crashing 1`] = ` | ||
ShallowWrapper { | ||
"length": 1, | ||
Symbol(enzyme.__root__): [Circular], | ||
Symbol(enzyme.__unrendered__): <Provider | ||
store={ | ||
Object { | ||
"dispatch": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
Symbol(observable): [Function], | ||
} | ||
} | ||
> | ||
<Connect(Follow) /> | ||
</Provider>, | ||
Symbol(enzyme.__renderer__): Object { | ||
"batchedUpdates": [Function], | ||
"getNode": [Function], | ||
"render": [Function], | ||
"simulateEvent": [Function], | ||
"unmount": [Function], | ||
}, | ||
Symbol(enzyme.__node__): Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object {}, | ||
"ref": null, | ||
"rendered": null, | ||
"type": [Function], | ||
}, | ||
Symbol(enzyme.__nodes__): Array [ | ||
Object { | ||
"instance": null, | ||
"key": undefined, | ||
"nodeType": "class", | ||
"props": Object {}, | ||
"ref": null, | ||
"rendered": null, | ||
"type": [Function], | ||
}, | ||
], | ||
Symbol(enzyme.__options__): Object { | ||
"adapter": ReactFifteenAdapter { | ||
"options": Object { | ||
"supportPrevContextArgumentOfComponentDidUpdate": true, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
File renamed without changes.
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 @@ | ||
import React from 'react'; | ||
import { mount, configure, shallow } from 'enzyme'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Follow from './index'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import Adapter from 'enzyme-adapter-react-15'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
describe('<Follow />', () => { | ||
const wrapper = shallow( | ||
<Provider store={store}> | ||
<Follow /> | ||
</Provider> | ||
); | ||
const container = wrapper.instance(); | ||
|
||
it('renders without crashing', () => { | ||
expect(wrapper).toBeTruthy(); | ||
expect(container).toBeTruthy(); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
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,30 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Map, List } from 'immutable'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Keys from './Keys'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
const mockAccount = Map({ | ||
name: 'maitland', | ||
posting: Map({ | ||
key_auths: [ | ||
List(['SOMETHING', 'HERE']), | ||
List(['ANOTHER THING', 'OVER THERE']), | ||
], | ||
}), | ||
}); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('Keys', () => ( | ||
<Center> | ||
<Keys account={mockAccount} authType="posting" onKey={() => {}} /> | ||
</Center> | ||
)); |
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 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Reblog from './Reblog'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('Reblog', () => ( | ||
<Center> | ||
<Reblog | ||
permlink={'foo/bar'} | ||
author={'maitland'} | ||
reblog={() => alert('STEEM WAZ HERE')} | ||
/> | ||
</Center> | ||
)); |
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,10 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import Reputation from './Reputation'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
storiesOf('Elements', module).add('Reputation', () => ( | ||
<Center> | ||
<Reputation value={1200} /> | ||
</Center> | ||
)); |
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,21 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, text } from '@storybook/addon-knobs'; | ||
import TransactionError from './TransactionError'; | ||
import { Center } from './Tooltip.story'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('TransactionError', () => ( | ||
<Center> | ||
<TransactionError | ||
opType="This is a test" | ||
error="There was an error ey" | ||
/> | ||
</Center> | ||
)); |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, text } from '@storybook/addon-knobs'; | ||
import WalletSubMenu from './WalletSubMenu'; | ||
import { Center } from './Tooltip.story'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('WalletSubMenu', () => ( | ||
<Center> | ||
<WalletSubMenu /> | ||
</Center> | ||
)); |
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
Oops, something went wrong.