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
import React from 'react' | |
import { shallow, mount, render } from 'enzyme' | |
import Root, { SearchBar, ReleaseTable, Release } from '../src/Root' | |
const createShallowRelease = (outOfPrint = true) => { | |
let props = {release: { artist: 'foobar', title: 'bar', outOfPrint }}; | |
return shallow(<Release {...props} />); | |
}; | |
describe('<Release>', () => { |
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
import React from 'react' | |
import { shallow, mount, render } from 'enzyme' | |
import Root, { SearchBar, ReleaseTable, Release } from '../src/Root' | |
const createShallowRelaseTable = (noOutOfPrint = false, searchText = '') => { | |
let items = [{ artist: 'foobar', title: 'bar', outOfPrint: true }]; | |
let props = { searchText, releases: items, noOutOfPrint }; | |
return shallow(<ReleaseTable { ...props } />); | |
} |
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
import React from 'react' | |
import { shallow, mount, render } from 'enzyme' | |
import Root, { SearchBar, ReleaseTable, Release } from '../src/Root' | |
describe('<SearchBar>', () => { | |
let onSearch; | |
beforeEach(() => { | |
onSearch = jasmine.createSpy('onSearch'); | |
}); |
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
{ | |
"name": "example-karma-jasmine-webapck-test-setup", | |
"description": "React Test Setup with Karma/Jasmine/Webpack", | |
"scripts": { | |
"test": "karma start --single-run --browsers PhantomJS" | |
}, | |
"devDependencies": { | |
"babel": "^6.5.2", | |
"babel-core": "^6.5.2", | |
"babel-eslint": "^5.0.0", |
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
import React, { PropTypes } from 'react'; | |
const foobar = (props) => ( | |
<div> | |
<h3>Testdrive. Stateless. Yes.</h3> | |
<div>{props.name}</div> | |
<div>{props.model}</div> | |
</div> | |
); |
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
import React, { PropTypes, Component } from 'react'; | |
import { createStore, combineReducers } from 'redux'; | |
import { render } from 'react-dom'; | |
let devCardTest = require('./DevCardsTest.js').default; | |
const devCardStyle = { | |
background: '#eee', | |
padding: '20px', | |
marginBottom: '10px' | |
}; |
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
// a basic example demonstrating the power of channels and generators | |
import React from 'react' | |
import { render } from 'react-dom' | |
import { chan, go, take, put, putAsync } from 'js-csp' | |
import { curry } from 'ramda' | |
import Counter from './Counter' | |
// helper | |
const createRender = curry((node, app) => render(app, node)) | |
// create one channel for now |
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
module LoadUsers exposing (..) | |
import Html exposing (Html, div, h1, text) | |
import Http | |
import Json.Decode as Decode | |
main = | |
Html.program | |
{ init = init |
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
const enhancedForm = Component => | |
class HigherOrderComponent extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { form: props.initialState } | |
this.handleSubmit = this.handleSubmit.bind(this) | |
this.handleChange = this.handleChange.bind(this) | |
} | |
handleSubmit(e) { |
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
import { | |
alts, | |
chan, | |
go, | |
operations, | |
putAsync, | |
take, | |
takeAsync, | |
timeout, | |
CLOSED, |
OlderNewer