-
home
- /
- {ns}
+ render() {
+ const { namespaces } = this.props
+ const { routes, activeNamespace } = this.state
+ const cards = namespaces[activeNamespace]
+ const navCard = this.renderNavCard(routes, activeNamespace)
+ return (
+
+
React Cards
+ {cards
+ ?
+ { [navCard, ...cards] }
+
+ :
+
+ {map(namespaces, (namespace, key) => (
+
+
+ { key }
+
+
+ ))}
+
-
- )
- }
+ }
+
+ )
+ }
+ renderNavCard(routes, ns) {
+ return (
+
+
+
+ )
+ }
}
diff --git a/src/StatefulCard.js b/src/StatefulCard.js
index a484d83..d62c8ce 100644
--- a/src/StatefulCard.js
+++ b/src/StatefulCard.js
@@ -29,7 +29,7 @@ export default class StatefulCard extends Component {
}
undo() {
if (this.state.history.length < 1) return
- const last = this.state.history[this.state.history.length-1]
+ const last = this.state.history[this.state.history.length - 1]
this.setState({
model: last,
history: this.state.history.slice(0, -1),
@@ -38,7 +38,7 @@ export default class StatefulCard extends Component {
}
redo() {
if (this.state.future.length < 1) return
- const last = this.state.future[this.state.future.length-1]
+ const last = this.state.future[this.state.future.length - 1]
this.setState({
model: last,
future: this.state.future.slice(0, -1),
@@ -67,7 +67,7 @@ export default class StatefulCard extends Component {
}
renderInspect() {
return (
-
+
model:
{JSON.stringify(this.getModel(), null, ' ')}
diff --git a/src/TestCard.js b/src/TestCard.js
index 310385f..06bc251 100644
--- a/src/TestCard.js
+++ b/src/TestCard.js
@@ -68,7 +68,7 @@ export default class TestCard extends Component {
try {
testModule[name]()
results.push([true, name])
- } catch(e) {
+ } catch (e) {
results.push([e, name])
}
})
@@ -77,7 +77,7 @@ export default class TestCard extends Component {
render() {
const {title, doc} = this.props
return (
-
+
{this.state.results.map(([result, name], index) => (
result === true
? {name}
diff --git a/src/components.js b/src/components.js
index b3632d0..f0e5754 100644
--- a/src/components.js
+++ b/src/components.js
@@ -1,6 +1,10 @@
-import React from 'react'
+import React ,{Component} from 'react'
+import ReactDOM from 'react-dom'
import showdown from 'showdown'
import style from './style.less'
+import Frame from 'react-frame-component'
+import {iframeResizer} from 'iframe-resizer'
+import iframeResizerContentWindow from 'raw!iframe-resizer/js/iframeResizer.contentWindow.min'
const markdownToHtml = str => {
const conv = new showdown.Converter()
@@ -20,13 +24,48 @@ export const CardList = (props) => (
)
-export const Card = (props) => (
-
- {props.title ? {props.title} : null}
- {props.doc ? {props.doc} : null}
- {props.children}
-
+export const MarkdownCard = (props) => (
+
{props.children}
)
-export const MarkdownCard = (props) =>
-
{props.children}
+export class Card extends Component {
+ constructor(props) {
+ super(props)
+ }
+
+ componentDidMount() {
+ if (!this.props.noframe) {
+ this.iframeNode = ReactDOM.findDOMNode(this.refs.iframe)
+ iframeResizer({checkOrigin:false},this.iframeNode)
+ }
+ }
+
+ componentWillUnmount() {
+ if (!this.props.noframe) {
+ this.iframeNode.iFrameResizer.close()
+ }
+ }
+
+ render() {
+ const props = this.props;
+ const iframeContent = `
+
+
+
+ `
+ return (
+
+ {props.title ?
{props.title} : null}
+ {props.doc ?
{props.doc} : null}
+ {props.noframe ?
+
{props.children}
:
+
+ {props.children}
+
+ }
+
+ );
+ }
+}
diff --git a/src/namespaceStore.js b/src/namespaceStore.js
index 75af9f1..b420e03 100644
--- a/src/namespaceStore.js
+++ b/src/namespaceStore.js
@@ -1,25 +1,25 @@
// a simplified example for handling namespaces and their corresponding changes
const namespaceStore = (initialState = {}) => ({
- namespaces: initialState,
- listeners: [],
- get(namespace) {
- return namespace? this.namespaces[namespace] : this.namespaces
- },
- set(namespace, cards) {
- this.namespaces[namespace] = cards
- this.notify()
- },
- subscribe(f) {
- this.listeners.push(f)
- return () => {
- this.listeners = this.listeners.filter(l => {
- return l !== f
- })
- }
- },
- notify() {
- this.listeners.map(l => l(this.namespaces))
+ namespaces: initialState,
+ listeners: [],
+ get(namespace) {
+ return namespace ? this.namespaces[namespace] : this.namespaces
+ },
+ set(namespace, cards) {
+ this.namespaces[namespace] = cards
+ this.notify()
+ },
+ subscribe(f) {
+ this.listeners.push(f)
+ return () => {
+ this.listeners = this.listeners.filter(l => {
+ return l !== f
+ })
}
+ },
+ notify() {
+ this.listeners.map(l => l(this.namespaces))
+ }
})
export default namespaceStore
diff --git a/src/style.less b/src/style.less
index 4a74948..436bc3b 100644
--- a/src/style.less
+++ b/src/style.less
@@ -24,6 +24,10 @@ body {
border-radius:2px;
font-family:sans-serif;
background-color:white;
+ iframe {
+ width: 100%;
+ border: none;
+ }
}
:local(.cardHeader) {
diff --git a/test/Container.test.js b/test/Container.test.js
index 2906051..f22352c 100644
--- a/test/Container.test.js
+++ b/test/Container.test.js
@@ -8,53 +8,53 @@ import { Card, CardList } from '../src/components'
const namespaces = { foo: [
,
], bar: [
] }
describe('Testing
', () => {
- beforeEach(() => {
- history = createHistory()
- })
-
- it('should show menu when no cards', () => {
- const component = shallow(
)
- expect(component.html()).to.contain('react-cards-menu')
- })
-
- it('should show menu when no active namespace', () => {
- const component = shallow(
)
- expect(component.html()).to.contain('react-cards-menu')
- })
-
- it('should hide menu when active namespace', () => {
- history.push('/#/foo')
- const component = shallow(
)
- expect(component.html()).to.not.contain('react-cards-menu')
- })
-
- it('should display no cards if active namespace doesn\'t contain cards', () => {
- history.push('/#/foobar')
- const component = shallow(
)
- expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
- })
-
- it('should display all cards for active namespace', () => {
- history.push('/#/foo')
- const component = mount(
)
- expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
+ beforeEach(() => {
+ history = createHistory()
+ })
+
+ it('should show menu when no cards', () => {
+ const component = shallow(
)
+ expect(component.html()).to.contain('react-cards-menu')
+ })
+
+ it('should show menu when no active namespace', () => {
+ const component = shallow(
)
+ expect(component.html()).to.contain('react-cards-menu')
+ })
+
+ it('should hide menu when active namespace', () => {
+ history.push('/#/foo')
+ const component = shallow(
)
+ expect(component.html()).to.not.contain('react-cards-menu')
+ })
+
+ it('should display no cards if active namespace doesn\'t contain cards', () => {
+ history.push('/#/foobar')
+ const component = shallow(
)
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
+ })
+
+ it('should display all cards for active namespace', () => {
+ history.push('/#/foo')
+ const component = mount(
)
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
// 1 nav header card + 2 foo cards
- expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
- })
-
- it('should display change card when active namespace changes', () => {
- history.push('/')
- const component = mount(
)
- expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
- history.push('/#/foo')
- expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
+ expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
+ })
+
+ it('should display change card when active namespace changes', () => {
+ history.push('/')
+ const component = mount(
)
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
+ history.push('/#/foo')
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
// 1 nav header card + 2 foo cards
- expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
- history.push('/#/foobar')
- expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
- history.push('/#/bar')
- expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
+ expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(3)
+ history.push('/#/foobar')
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(0)
+ history.push('/#/bar')
+ expect(component.find('.react-cards-namespace-cards')).to.have.length(1)
// 1 nav header card + 1 bar card
- expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(2)
- })
+ expect(component.find('.react-cards-namespace-cards .reactcards-card')).to.have.length(2)
+ })
})
diff --git a/test/StatefulCard.test.js b/test/StatefulCard.test.js
index 63c1fa1..249956b 100644
--- a/test/StatefulCard.test.js
+++ b/test/StatefulCard.test.js
@@ -4,65 +4,65 @@ import { expect } from 'chai'
import StatefulCard from '../src/StatefulCard'
const StatelessCounter = props => (
-
-
- {props.value}
-
-
+
+
+ {props.value}
+
+
)
const content = (state) =>
-
state.update(x => x + 1)}
- dec={() => state.update(x => x - 1)}/>
+ state.update(x => x + 1)}
+ dec={() => state.update(x => x - 1)}/>
describe('Testing ', () => {
- it('should display children content', () => {
- const component = shallow({ content })
- expect(component.find(StatelessCounter)).to.be.length(1)
- })
+ it('should display children content', () => {
+ const component = shallow({ content })
+ expect(component.find(StatelessCounter)).to.be.length(1)
+ })
- it('should initial value', () => {
- const init = 123
- const component = shallow({ content })
- expect(component.html()).to.contain(init)
- })
+ it('should initial value', () => {
+ const init = 123
+ const component = shallow({ content })
+ expect(component.html()).to.contain(init)
+ })
- it('should display history', () => {
- const component = shallow({ content })
- expect(component.find('.react-cards-history-control')).to.be.length(1)
- })
+ it('should display history', () => {
+ const component = shallow({ content })
+ expect(component.find('.react-cards-history-control')).to.be.length(1)
+ })
- it('should display inspect', () => {
- const component = shallow({ content })
- expect(component.find('.react-cards-inspect')).to.be.length(1)
- })
+ it('should display inspect', () => {
+ const component = shallow({ content })
+ expect(component.find('.react-cards-inspect')).to.be.length(1)
+ })
- it('should display current state', () => {
- const component = mount({ content })
- expect(component.find('#theCurrentValue').text()).to.be.equal('10')
+ it('should display current state', () => {
+ const component = mount({ content })
+ expect(component.find('#theCurrentValue').text()).to.be.equal('10')
// click on increade button should change the value
- const incBtn = component.find('#increase')
- incBtn.simulate('click')
- expect(component.find('#theCurrentValue').text()).to.be.equal('11')
- incBtn.simulate('click')
- expect(component.find('#theCurrentValue').text()).to.be.equal('12')
- })
+ const incBtn = component.find('#increase')
+ incBtn.simulate('click')
+ expect(component.find('#theCurrentValue').text()).to.be.equal('11')
+ incBtn.simulate('click')
+ expect(component.find('#theCurrentValue').text()).to.be.equal('12')
+ })
- it('should update state when undo/redo is clicked', () => {
- const component = mount({ content })
- expect(component.find('#theCurrentValue').text()).to.be.equal('100')
+ it('should update state when undo/redo is clicked', () => {
+ const component = mount({ content })
+ expect(component.find('#theCurrentValue').text()).to.be.equal('100')
// click on increase button should change the value
- const incBtn = component.find('#increase')
- incBtn.simulate('click')
- expect(component.find('#theCurrentValue').text()).to.be.equal('101')
+ const incBtn = component.find('#increase')
+ incBtn.simulate('click')
+ expect(component.find('#theCurrentValue').text()).to.be.equal('101')
// click on undo should change the value
- const undoBtn = component.find('#react-cards-undo')
- const redoBtn = component.find('#react-cards-redo')
- undoBtn.simulate('click')
- expect(component.find('#theCurrentValue').text()).to.be.equal('100')
- redoBtn.simulate('click')
- expect(component.find('#theCurrentValue').text()).to.be.equal('101')
- })
+ const undoBtn = component.find('#react-cards-undo')
+ const redoBtn = component.find('#react-cards-redo')
+ undoBtn.simulate('click')
+ expect(component.find('#theCurrentValue').text()).to.be.equal('100')
+ redoBtn.simulate('click')
+ expect(component.find('#theCurrentValue').text()).to.be.equal('101')
+ })
})
diff --git a/test/TestCard.test.js b/test/TestCard.test.js
index d3aa28a..10531c7 100644
--- a/test/TestCard.test.js
+++ b/test/TestCard.test.js
@@ -4,27 +4,27 @@ import { assert, expect } from 'chai'
import TestCard from '../src/TestCard'
function randomSuccessfulTest() {
- assert.equal(1, 1)
+ assert.equal(1, 1)
}
function randomUnsuccessfulTest() {
- assert.equal(1, 2)
+ assert.equal(1, 2)
}
const testModule = {randomSuccessfulTest};
describe('Testing ', () => {
- it('should display the test name', () => {
- const component = mount()
- expect(component.text()).to.contain('randomSuccessfulTest')
- })
+ it('should display the test name', () => {
+ const component = mount()
+ expect(component.text()).to.contain('randomSuccessfulTest')
+ })
- it('should display the correct result when test succeeds', () => {
- const component = mount()
- expect(component.html()).to.be.contain(('react-card-test-success'))
- })
+ it('should display the correct result when test succeeds', () => {
+ const component = mount()
+ expect(component.html()).to.be.contain(('react-card-test-success'))
+ })
- it('should display the correct result when test fails', () => {
- const component = mount()
- expect(component.html()).to.contain('react-card-test-failure')
- })
+ it('should display the correct result when test fails', () => {
+ const component = mount()
+ expect(component.html()).to.contain('react-card-test-failure')
+ })
})
diff --git a/test/cards.test.js b/test/cards.test.js
index a190c23..e51cc73 100644
--- a/test/cards.test.js
+++ b/test/cards.test.js
@@ -10,73 +10,71 @@ let history
const Foo = ({ message }) => { message }
const StatelessCounter = props => (
-
-
- {props.value}
-
-
+
+
+ {props.value}
+
+
)
describe('Test React Cards', () => {
- beforeEach(() => {
- rc = ReactCards('foo');
- history = createHistory()
- })
+ beforeEach(() => {
+ rc = ReactCards('foo');
+ history = createHistory()
+ })
- it('Should display the namespace in menu', () => {
- rc.card(, 'here is a simple example')
- const root = mount()
- expect(root.html()).to.contain('foo')
- })
+ it('Should display the namespace in menu', () => {
+ rc.card(, 'here is a simple example')
+ const root = mount()
+ expect(root.html()).to.contain('foo')
+ })
- it('Should display the card if namespace is selected', () => {
- rc.card(, 'here is a simple example')
- history.push('/#/foo')
- const root = mount()
- expect(root.html()).to.contain('hello this is a test')
- })
+ it('Should display the card if namespace is selected', () => {
+ rc.card(, 'here is a simple example')
+ history.push('/#/foo')
+ const root = mount()
+ expect(root.html()).to.contain('hello this is a test')
+ })
- it('Should display all the cards if namespace is selected', () => {
- rc.card(, 'here is a simple example')
- rc.card(, 'here is a simple example')
- history.push('/#/foo')
- const root = mount()
- expect(root.html()).to.contain('hello this is a test')
- expect(root.html()).to.contain('hello this is another test')
- })
+ it('Should display all the cards if namespace is selected', () => {
+ rc.card(, 'here is a simple example')
+ rc.card(, 'here is a simple example')
+ history.push('/#/foo')
+ const root = mount()
+ expect(root.html()).to.contain('hello this is a test')
+ expect(root.html()).to.contain('hello this is another test')
+ })
- it('Should display a statful card if namespace is selected', () => {
- rc.card(
- (state) =>
- state.update(x => x + 1)}
- dec={() => state.update(x => x - 1)}/>,
- {
- init: 123
- }
- )
- history.push('/#/foo')
- const root = mount()
- expect(root.find('button')).to.be.length(2)
- expect(root.find('#model').text()).to.be.equal('123')
+ it('Should display a statful card if namespace is selected', () => {
+ rc.card( (state) =>
+ state.update(x => x + 1)}
+ dec={() => state.update(x => x - 1)}/>,
+ {
+ init: 123
+ }
+ )
+ history.push('/#/foo')
+ const root = mount()
+ expect(root.find('button')).to.be.length(2)
+ expect(root.find('#model').text()).to.be.equal('123')
+ })
- })
+ it('Should display a markdown card if namespace is selected', () => {
+ rc.markdown('_test some random markdown_')
+ history.push('/#/foo')
+ const root = mount()
+ expect(root.html()).to.contain('test some random markdown')
+ })
- it('Should display a markdown card if namespace is selected', () => {
- rc.markdown('_test some random markdown_')
- history.push('/#/foo')
- const root = mount()
- expect(root.html()).to.contain('test some random markdown')
- })
-
- it('should display a test card if namespace is selected', () => {
- const assertSomething = () => assert.equals(1, 1)
- rc.test({ assertSomething }, {title:'some random test'})
- history.push('/#/foo')
- const root = mount()
- expect(root.html()).to.contain('some random test')
- expect(root.html()).to.contain('assertSomething')
- })
+ it('should display a test card if namespace is selected', () => {
+ const assertSomething = () => assert.equals(1, 1)
+ rc.test({ assertSomething }, {title:'some random test'})
+ history.push('/#/foo')
+ const root = mount()
+ expect(root.html()).to.contain('some random test')
+ expect(root.html()).to.contain('assertSomething')
+ })
})
diff --git a/test/components.test.js b/test/components.test.js
index 1da2f56..3053233 100644
--- a/test/components.test.js
+++ b/test/components.test.js
@@ -4,34 +4,34 @@ import { expect } from 'chai'
import { Card, MarkdownCard } from '../src/components'
describe('Testing React Cards components', () => {
- describe('', () => {
- it('should display title', () => {
- const component = shallow()
- expect(component.contains('hello')).to.be.true
- })
+ describe('', () => {
+ it('should display title', () => {
+ const component = shallow()
+ expect(component.contains('hello')).to.be.true
+ })
- it('should display doc', () => {
- const component = shallow()
- expect(component.contains('some doc')).to.be.true
- })
+ it('should display doc', () => {
+ const component = shallow()
+ expect(component.contains('some doc')).to.be.true
+ })
- it('should display children content', () => {
- const component = shallow(Some Content)
- expect(component.contains('Some Content')).to.be.true
- })
+ it('should display children content', () => {
+ const component = shallow(Some Content)
+ expect(component.contains('Some Content')).to.be.true
+ })
- it('should display title doc and child components', () => {
- const component = shallow(Some Content)
- expect(component.contains('hello')).to.be.true
- expect(component.contains('some doc')).to.be.true
- expect(component.contains('Some Content')).to.be.true
- })
+ it('should display title doc and child components', () => {
+ const component = shallow(Some Content)
+ expect(component.contains('hello')).to.be.true
+ expect(component.contains('some doc')).to.be.true
+ expect(component.contains('Some Content')).to.be.true
})
+ })
- describe('', () => {
- it('should return valid html', () => {
- const component = mount(_Some Header_)
- expect(component.html()).to.contain('Some Header')
- })
+ describe('', () => {
+ it('should return valid html', () => {
+ const component = mount(_Some Header_)
+ expect(component.html()).to.contain('Some Header')
})
+ })
})
diff --git a/test/namespaceStore.test.js b/test/namespaceStore.test.js
index e2fd5a1..5095ecd 100644
--- a/test/namespaceStore.test.js
+++ b/test/namespaceStore.test.js
@@ -8,39 +8,39 @@ const fooValue = [{id: 2}]
let store;
describe('namespaceStore', () => {
- beforeEach(() => {
- store = namespaceStore()
- })
- it('should supply setter/getter for a given namespace', () => {
- store.set('bar', barValue)
- expect(store.get('bar')).to.be.equal(barValue)
- })
+ beforeEach(() => {
+ store = namespaceStore()
+ })
+ it('should supply setter/getter for a given namespace', () => {
+ store.set('bar', barValue)
+ expect(store.get('bar')).to.be.equal(barValue)
+ })
- it('should return all namespace', () => {
- store.set('foo', fooValue)
- store.set('bar', barValue)
- expect(store.get()).to.be.eql({foo: fooValue, bar: barValue})
- })
+ it('should return all namespace', () => {
+ store.set('foo', fooValue)
+ store.set('bar', barValue)
+ expect(store.get()).to.be.eql({foo: fooValue, bar: barValue})
+ })
- it('should notify any subscriber when state changes', () => {
- const subscriberFn = sinon.spy();
- const unsubscribe = store.subscribe(subscriberFn)
- store.set('foo', fooValue)
- sinon.assert.calledWith(subscriberFn, {foo: fooValue});
- store.set('bar', barValue)
- sinon.assert.calledWith(subscriberFn, {foo: fooValue, bar: barValue});
- unsubscribe()
- })
+ it('should notify any subscriber when state changes', () => {
+ const subscriberFn = sinon.spy();
+ const unsubscribe = store.subscribe(subscriberFn)
+ store.set('foo', fooValue)
+ sinon.assert.calledWith(subscriberFn, {foo: fooValue});
+ store.set('bar', barValue)
+ sinon.assert.calledWith(subscriberFn, {foo: fooValue, bar: barValue});
+ unsubscribe()
+ })
- it('should unsubscribe any listener', () => {
- const subscriberFn = sinon.spy();
- const unsubscribe = store.subscribe(subscriberFn)
- store.set('foo', {id:4})
- sinon.assert.calledWith(subscriberFn, {foo: {id:4}});
+ it('should unsubscribe any listener', () => {
+ const subscriberFn = sinon.spy();
+ const unsubscribe = store.subscribe(subscriberFn)
+ store.set('foo', {id:4})
+ sinon.assert.calledWith(subscriberFn, {foo: {id:4}});
// unsubscribe. any notifications from now on should not effect the subscribeFn anymore
- unsubscribe()
- store.set('bar', {id:5})
- store.set('bar', {id:6})
- sinon.assert.calledOnce(subscriberFn)
- })
-})
\ No newline at end of file
+ unsubscribe()
+ store.set('bar', {id:5})
+ store.set('bar', {id:6})
+ sinon.assert.calledOnce(subscriberFn)
+ })
+})
diff --git a/test/setup.js b/test/setup.js
index 573540e..e22324b 100644
--- a/test/setup.js
+++ b/test/setup.js
@@ -9,14 +9,14 @@ var exposedProperties = ['window', 'navigator', 'document'];
global.document = jsdom('');
global.window = document.defaultView;
Object.keys(document.defaultView).forEach((property) => {
- if (typeof global[property] === 'undefined') {
- exposedProperties.push(property);
- global[property] = document.defaultView[property];
- }
+ if (typeof global[property] === 'undefined') {
+ exposedProperties.push(property);
+ global[property] = document.defaultView[property];
+ }
});
global.navigator = {
- userAgent: 'node.js'
+ userAgent: 'node.js'
};
documentRef = document;
diff --git a/webpack.config.js b/webpack.config.js
index 0248f2b..f7fe279 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,37 +1,37 @@
var path = require('path')
module.exports = {
//devtool: 'source-map',
- context: path.join(__dirname, "src"),
- entry: [
- 'webpack/hot/only-dev-server',
- 'react-hot-loader/patch',
- './main'
- ],
- output: {
- filename: "app.js",
- path: path.join(__dirname, "public")
- },
+ context: path.join(__dirname, "src"),
+ entry: [
+ 'webpack/hot/only-dev-server',
+ 'react-hot-loader/patch',
+ './main'
+ ],
+ output: {
+ filename: "app.js",
+ path: path.join(__dirname, "public")
+ },
- module: {
- loaders: [
- {
- test: /\.js$/,
- exclude: /node_modules/,
- loaders: ['babel?{presets:["es2015", "react", "stage-2"], plugins:["react-hot-loader/babel"]}']
- }
- ]
- },
+ module: {
+ loaders: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ loaders: ['babel?{presets:["es2015", "react", "stage-2"], plugins:["react-hot-loader/babel"]}']
+ }
+ ]
+ },
- node: {
- fs: "empty"
- },
+ node: {
+ fs: "empty"
+ },
- // we need this because of enzyme
- // see https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md
- externals: {
- 'cheerio': 'window',
- 'react/addons': true,
- 'react/lib/ExecutionEnvironment': true,
- 'react/lib/ReactContext': true
- }
+ // we need this because of enzyme
+ // see https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md
+ externals: {
+ 'cheerio': 'window',
+ 'react/addons': true,
+ 'react/lib/ExecutionEnvironment': true,
+ 'react/lib/ReactContext': true
+ }
};