Skip to content

Commit

Permalink
feat: add react-storybook support
Browse files Browse the repository at this point in the history
- include storybook builds as part of deployment;
- update `wdio` directory position for cleanliness;
- update packages and associated unit tests;
  • Loading branch information
Josh David Miller authored Sep 16, 2016
1 parent 3736047 commit e02402b
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 15 deletions.
6 changes: 6 additions & 0 deletions conf/storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { configure } from '@kadira/storybook';

const req = require.context( '../../src', true, /story\.js$/ );

configure( () => req.keys().forEach( req ), module );

10 changes: 10 additions & 0 deletions conf/storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var path = require( 'path' );

module.exports = {
resolve: {
root: [
path.resolve( './src' ),
],
},
};

File renamed without changes.
2 changes: 1 addition & 1 deletion wdio/run.js → conf/wdio/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const cwd = process.cwd();
require( 'babel-polyfill' );
require( 'babel-register' );

glob( 'src/**/*scenario.js', function ( err, files ) {
glob( '../../src/**/*scenario.js', function ( err, files ) {
require( './setup.js' );

files.forEach( function ( file ) {
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
"build:html": "mkdir -p build && cp index.html build/",
"build": "npm run build:html && npm run build:webpack",
"test:unit": "tape build/specs.js | faucet",
"test:e2e": "node wdio/run.js | faucet",
"test:e2e": "node conf/wdio/run.js | faucet",
"pretest": "npm run build",
"test": "npm run test:unit && echo SKIPPING: e2e tests",
"start": "node server.js",
"dev": "npm run build:html && BUILD_ENV=development webpack-dev-server --hot --inline --config webpack.config.js --content-base build --port 8888 --host 0.0.0.0 --history-api-fallback",
"storybook": "start-storybook -p 9001 -c conf/storybook",
"build-storybook": "build-storybook -c conf/storybook",
"selenium:install": "selenium-standalone install",
"selenium:start": "selenium-standalone start &> /dev/null &",
"selenium": "npm run selenium:install && npm run selenium:start",
Expand All @@ -37,6 +39,7 @@
},
"homepage": "https://github.com/StoryShop/app#readme",
"devDependencies": {
"@kadira/storybook": "^2.14.0",
"autoprefixer": "^6.3.3",
"babel-loader": "^6.2.2",
"babel-polyfill": "^6.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test( 'App Render Method', t => {
const instance = getShallowInstance( <App /> );

// FIXME(jdm): This test requires knowing what DocumentTitle renders.
const expected = 'SideEffect(Component)';
const expected = 'SideEffect(DocumentTitle)';
const actual = instance.type.displayName;

t.equals( actual, expected, 'rendered the DocumentTitle element' );
Expand Down
2 changes: 1 addition & 1 deletion src/components/autoprefix/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test( 'Autoprefix HOC', t => {
const result = getShallowInstance( <WrappedComponent style={{ display: 'flex' }} /> );
const actual = result.props.style;
const expected = {
display: [ '-webkit-box', '-webkit-flex', '-ms-flexbox', 'flex' ],
display: [ '-webkit-box', '-ms-flexbox', 'flex' ],
};

t.deepEquals( actual, expected, 'should prefix CSS properties' );
Expand Down
14 changes: 14 additions & 0 deletions src/components/inline-edit/story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';

import InlineEdit from './';

storiesOf( 'InlineEdit', module )
.add( 'default', () => (
<InlineEdit
defaultValue='value...'
onChange={action('onChange')}
/>
))
;

2 changes: 1 addition & 1 deletion src/routes/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../wdio';
import browser from '../../conf/wdio';

test( 'Left Nav', async t => {
let actual, expected;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/characters/list/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../../wdio';
import browser from '../../../../../../conf/wdio';
import ids from '../../../../../utils/ids.json';

test( 'Characters Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/characters/one/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../../wdio';
import browser from '../../../../../../conf/wdio';
import ids from '../../../../../utils/ids.json';

test( 'Characters Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/elements/list/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../../wdio';
import browser from '../../../../../../conf/wdio';
import ids from '../../../../../utils/ids.json';

test( 'Characters Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/elements/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../wdio';
import browser from '../../../../../conf/wdio';
import ids from '../../../../utils/ids.json';

test( 'Elements Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/outlines/list/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../../wdio';
import browser from '../../../../../../conf/wdio';
import ids from '../../../../../utils/ids.json';

test( 'Characters Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/outlines/one/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../../wdio';
import browser from '../../../../../../conf/wdio';
import ids from '../../../../../utils/ids.json';

test( 'Characters Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/outlines/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../wdio';
import browser from '../../../../../conf/wdio';
import ids from '../../../../utils/ids.json';

test( 'Outlines Placeholder Route', async t => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/settings/po.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import browser from '../../../../../wdio';
import browser from '../../../../../conf/wdio';

export default id => ({
titleSelector: '.world-jumbotron h1 textarea',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/worlds/one/settings/scenario.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import browser from '../../../../../wdio';
import browser from '../../../../../conf/wdio';
import ids from '../../../../utils/ids.json';
import SettingsPage from './po';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/autoprefix/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test( 'autoprefix', t => {
const actual = prefix( style );

const expected = {
display: [ '-webkit-box', '-webkit-flex', '-ms-flexbox', 'flex' ],
display: [ '-webkit-box', '-ms-flexbox', 'flex' ],
};

t.deepEquals( actual, expected, 'should prefix CSS properties' );
Expand Down

0 comments on commit e02402b

Please sign in to comment.