Skip to content

Commit

Permalink
Update react to 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdlehman committed Oct 8, 2015
1 parent 74126aa commit 81b5603
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@
"karma-webpack": "^1.7.0",
"mocha": "^2.3.3",
"phantomjs": "^1.9.18",
"react": ">=0.12.0 <0.14.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"sinon": "git://github.com/cjohansen/Sinon.JS#b672042043517b9f84e14ed0fb8265126168778a",
"webpack": "^1.12.2"
},
"peerDependencies": {
"react": ">=0.12.0 <0.14.0"
"react": "^0.14.0"
}
}
31 changes: 16 additions & 15 deletions test/components/Switcher_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import {assert} from 'chai';
import sinon from 'sinon';
import window from 'window';
Expand All @@ -19,7 +20,7 @@ describe('Switcher', function() {
describe('#getLocation', function() {
describe('using location.hash', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher>
<div path="/">Home</div>
<div path="/another">Another</div>
Expand Down Expand Up @@ -53,7 +54,7 @@ describe('Switcher', function() {

describe('using location.pathname', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher location="pathname">
<div path="/">Home</div>
<div path="/another">Another</div>
Expand Down Expand Up @@ -89,7 +90,7 @@ describe('Switcher', function() {
describe('#getSwitch', function() {
describe('default', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher>
<div path="/">Home</div>
<div path="/another">Another</div>
Expand Down Expand Up @@ -151,7 +152,7 @@ describe('Switcher', function() {

describe('with basepath set', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher basePath="/base">
<div path="/">Home</div>
<div path="/another">Another</div>
Expand All @@ -176,7 +177,7 @@ describe('Switcher', function() {
describe('#handleRouteChange', function() {
describe('default', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher>
<div path="/">Home</div>
</Switcher>,
Expand All @@ -200,7 +201,7 @@ describe('Switcher', function() {
describe('with onChange function defined', function() {
beforeEach(function() {
this.handleChange = sinon.spy();
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher onChange={this.handleChange}>
<div path="/">Home</div>
</Switcher>,
Expand All @@ -222,7 +223,7 @@ describe('Switcher', function() {
describe('#render', function() {
describe('default', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher>
<div path="/">Home</div>
</Switcher>,
Expand All @@ -237,22 +238,22 @@ describe('Switcher', function() {
it('renders nothing if no match', function() {
window.location.hash = '/nomatch';
this.switcher.handleRouteChange();
var node = React.findDOMNode(this.switcher);
var node = ReactDOM.findDOMNode(this.switcher);
assert.isNull(node);
});

it('renders matching component', function() {
window.location.hash = '/';
this.switcher.handleRouteChange();
var node = React.findDOMNode(this.switcher);
var node = ReactDOM.findDOMNode(this.switcher);
assert.equal(node.innerHTML, 'Home');
});
});

describe('with default handler', function() {
beforeEach(function() {
var props = {text: 'Hello'};
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher
defaultHandler={Handler}
defaultHandlerProps={props}>
Expand All @@ -269,21 +270,21 @@ describe('Switcher', function() {
it('renders default handler when no match', function() {
window.location.hash = '/nomatch';
this.switcher.handleRouteChange();
var node = React.findDOMNode(this.switcher);
var node = ReactDOM.findDOMNode(this.switcher);
assert.equal(node.innerHTML, 'Hello');
});

it('renders matching component', function() {
window.location.hash = '/';
this.switcher.handleRouteChange();
var node = React.findDOMNode(this.switcher);
var node = ReactDOM.findDOMNode(this.switcher);
assert.equal(node.innerHTML, 'Home');
});
});

describe('with wrapper', function() {
beforeEach(function() {
this.switcher = React.render(
this.switcher = ReactDOM.render(
<Switcher wrapper="span">
<div path="/">Home</div>
</Switcher>,
Expand All @@ -298,15 +299,15 @@ describe('Switcher', function() {
it('renders just wrapper when no match', function() {
window.location.hash = '/nomatch';
this.switcher.handleRouteChange();
var wrapper = React.findDOMNode(this.switcher);
var wrapper = ReactDOM.findDOMNode(this.switcher);
assert.equal(wrapper.innerHTML, '');
assert.equal(wrapper.tagName, 'SPAN');
});

it('renders matched component in wrapper', function() {
window.location.hash = '/';
this.switcher.handleRouteChange();
var wrapper = React.findDOMNode(this.switcher);
var wrapper = ReactDOM.findDOMNode(this.switcher);
var component = wrapper.children[0];
assert.equal(wrapper.tagName, 'SPAN');
assert.equal(component.innerHTML, 'Home');
Expand Down

0 comments on commit 81b5603

Please sign in to comment.