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
it.only('picks up state change after promise', function(done) { | |
const input = TestUtils.renderIntoDocument(<input onChange={sinon.spy()} />); | |
const p = new Promise(function(resolve, reject) { | |
setTimeout(() => { | |
TestUtils.Simulate.change(React.findDOMNode(input)); | |
resolve(true); | |
}, 10); | |
}); | |
p.then(function(result) { | |
expect(result).to.be.true; |
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 input = TestUtils.renderIntoDocument(<input onChange={sinon.spy()} />); | |
const p = new Promise(function(resolve, reject) { | |
TestUtils.Simulate.change(React.findDOMNode(input)); | |
resolve(true); | |
}); | |
p.then(function(result) { | |
expect(result).to.be.true; | |
expect(input.props.onChange).has.been.calledOnce; | |
}).then(done, done); |
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 input = TestUtils.renderIntoDocument(<input onChange={sinon.spy()} />); | |
Promise.resolve(true).then(result => { | |
TestUtils.Simulate.change(React.findDOMNode(input)); | |
return result; | |
}).then(function(result) { | |
expect(result).to.be.true; | |
expect(input.props.onChange).has.been.calledOnce; | |
}).then(done, done); |
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 requestToPromise = function(requestObject) { | |
return new Promise(function(resolve, reject) { | |
requestObject | |
.end(function(err, res) { | |
if (err) { | |
reject(err); | |
} | |
else { | |
resolve(res.body); | |
} |
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
var expect = require('chai').expect; | |
describe('truthiness', function() { | |
function falsyFoo(x) { | |
return !(x && x.foo) || x; | |
} | |
it('doesn\'t blow up', function() { | |
expect(falsyFoo(undefined)).to.be.true; | |
expect(falsyFoo({ foo: false })).to.be.true; | |
expect(falsyFoo({ foo: true })).to.be.false; | |
}); |
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
https://gist.github.com/aa3bb43eda25880e3773 |
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
/** | |
* Perform a heuristic test to determine if an object is "array-like". | |
* | |
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" | |
* Joshu replied: "Mu." | |
* | |
* This function determines if its argument has "array nature": it returns | |
* true if the argument is an actual array, an `arguments' object, or an | |
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). | |
* |
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 React = require('react'); | |
const TestUtils = React.addons.TestUtils; | |
const Checkbox = React.createClass({ | |
render() { | |
return <input type="checkbox"></input> | |
} | |
}); | |
describe('Checkbox', function() { |
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
<VirtualHost *:8081> | |
<IfModule mod_proxy.c> | |
ProxyPass / http://127.0.0.1:8080/ | |
ProxyPreserveHost On | |
</IfModule> | |
</VirtualHost> |
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
$ sudo gem install bundler | |
ERROR: While executing gem ... (Errno::EPERM) | |
Operation not permitted - /usr/bin/bundle |