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 {shallow, configure} = require('enzyme'); | |
const ReactSixteenAdapter = require('enzyme/build/adapters/ReactSixteenAdapter'); | |
configure({adapter: new ReactSixteenAdapter()}); | |
// your test |
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
export type HostConfig<T, P, I, TI, PI, C, CX, PL> = { | |
getRootHostContext(rootContainerInstance: C): CX { | |
// e.g. namespace of DOM | |
}, | |
getChildHostContext(parentHostContext: CX, type: T, instance: C): CX { | |
// e.g. namespace of DOM | |
}, | |
getPublicInstance(instance: I | TI): PI { | |
// e.g. DOM Element |
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
/** | |
* @providesModule ReactVoice | |
*/ | |
'use strict'; | |
const {spawnSync} = require('child_process'); | |
const ReactDOMFrameScheduling = require('ReactDOMFrameScheduling'); | |
const ReactFiberReconciler = require('ReactFiberReconciler'); | |
const sideEffect = (method, text) => spawnSync('say', ['-v', method, text]); |
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
/** | |
* @providesModule ReactConsole | |
*/ | |
'use strict'; | |
const colors = require('colors'); | |
const ReactDOMFrameScheduling = require('ReactDOMFrameScheduling'); | |
const ReactFiberReconciler = require('ReactFiberReconciler'); |
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
node_modules/ |
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
location / { | |
if ($http_origin = 'http://api.example.com') { | |
set $cors 'true'; | |
} | |
if ($request_method = 'OPTIONS') { | |
set $cors "${cors}:options"; | |
} | |
if ($request_method ~ ^(POST|GET)$) { | |
set $cors "${cors}:allow_methods"; | |
} |
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
[ | |
{ "key": "shift+ctrl+n", "command": "cursorDownSelect", | |
"when": "editorTextFocus" }, | |
{ "key": "shift+ctrl+p", "command": "cursorUpSelect", | |
"when": "editorTextFocus" }, | |
{ "key": "shift+ctrl+f", "command": "cursorRightSelect", | |
"when": "editorTextFocus" }, | |
{ "key": "shift+ctrl+b", "command": "cursorLeftSelect", | |
"when": "editorTextFocus" }, | |
{ "key": "ctrl+n", "command": "selectNextSuggestion", |
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 assign from 'object-assign'; | |
export default function fakeFetch(res) { | |
global.fetch = (url, params) => { | |
return Promise.resolve(assign({}, res, {__arg: {url, params}})); | |
}; | |
} |
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'; | |
const Static = Component => class extends React.Component { | |
shouldComponentUpdate() { | |
return false; | |
} | |
render() { | |
return <Component {...this.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
class Sample extends React.Component { | |
getInitialState() { | |
return { data: this.props.initialData }; | |
} | |
componentDidMount() { | |
if (!this.props.initialDada) { | |
request('/api/xxx') | |
.end((err, res) => { | |
this.setState({ data: res.body }); | |
}) |