This file contains hidden or 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, {Component, PropTypes} from 'react'; | |
/** | |
* createNthChild is a factory for NthChild components. | |
* | |
* Can set conditional styling meant to simulate css's nth-child pseudo selector | |
* | |
* @param {object} [options] - styles options to pass into the icon panel | |
* @param {function} [styleFirst] - if isFirst, invoke styleLast(options.styles) |
This file contains hidden or 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": "testjest", | |
"version": "0.1.0", | |
"description": "", | |
"main": "src/index.js", | |
"scripts": { | |
"testold": "./node_modules/.bin/mocha --compilers js:babel-register src/**/__tests__/**/*test*.js", | |
"test": "NODE_ENV=test jest --no-cache", | |
"webpack": "NODE_ENV=production ./node_modules/.bin/webpack --progress", | |
"build": "npm run webpack", |
This file contains hidden or 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
jest.unmock('../components/Counter'); | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import TestUtils from 'react-addons-test-utils'; | |
import Counter from '../components/Counter'; | |
describe('Counter Component', () => { |
This file contains hidden or 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
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] |
This file contains hidden or 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, {Component, PropTypes} from 'react'; | |
import {bindActionCreators} from 'redux'; | |
import {connect} from 'react-redux'; | |
import * as windowActions from 'actions/windowMonitorActions'; | |
/** | |
* connectWindow is a high order component that will update the windowMonitor | |
* store once the client window has loaded and connect decorated component's |
This file contains hidden or 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
/** | |
* Helpers for breaking objects into arrays | |
*/ | |
// returns a generator of the objects keys | |
export function *generateKeys(obj) { | |
let prop; | |
for (prop of obj) { | |
yield prop; | |
} |
This file contains hidden or 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
// currentBG = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs='; // single white pixel | |
componentDidMount() { | |
// set background image after compnent has been built | |
this.setState({ | |
...this.state, | |
styles: { | |
...this.state.styles, |
This file contains hidden or 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, {Component, PropTypes} from 'react'; | |
export default class GalleryItem extends Component { | |
static propTypes = { | |
src: PropTypes.string, | |
} | |
render() { | |
return ( |
This file contains hidden or 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
let katdawg = { | |
kat: { | |
says: { | |
meow: '...' | |
} | |
}, | |
dawg: { | |
bark: 'woof' | |
} |
This file contains hidden or 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
class ContextComponent extend React.Componet { | |
static contextTypes = { | |
store: PropTypes.object, | |
} | |
componentDidMount() { | |
this.unsubscribe = this.context.store.subscribe(() => { | |
this.forceUpdate(); |