Skip to content

Commit a778387

Browse files
committed
Merge branch 'master' into next
2 parents 987f6aa + 8b3569b commit a778387

File tree

10 files changed

+78
-83
lines changed

10 files changed

+78
-83
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ cache:
66
directories:
77
- node_modules
88
before_install:
9-
- export CHROME_BIN=chromium-browser
10-
- export DISPLAY=:99.0
11-
- sh -e /etc/init.d/xvfb start
9+
- export CHROME_BIN=chromium-browser
10+
- export DISPLAY=:99.0
11+
- sh -e /etc/init.d/xvfb start
1212
after_success:
1313
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
1414
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
[#3446]: https://github.com/reactjs/react-router/pull/3446
1515

1616

17+
## [v2.6.0]
18+
> Jul 18, 2016
19+
20+
- **Feature:** Add `prevState` as argument to `onLeave` hooks ([#3616])
21+
- **Bugfix:** Fix when the `<Link>` `onClick` invariant runs ([#3636])
22+
23+
[v2.6.0]: https://github.com/reactjs/react-router/compare/v2.5.2...v2.6.0
24+
[#3616]: https://github.com/reactjs/react-router/pull/3616
25+
[#3636]: https://github.com/reactjs/react-router/pull/3636
26+
27+
1728
## [v2.5.2]
1829
> Jul 1, 2016
1930

docs/API.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ A `<Link>` can know when the route it links to is active and automatically apply
9494

9595
#### Props
9696
##### `to`
97-
A [location descriptor](https://github.com/ReactJSTraining/history/blob/master/docs/Glossary.md#locationdescriptor). Usually this is a string or an object, with the following semantics:
97+
A [location descriptor](https://github.com/ReactTraining/history/blob/master/docs/Glossary.md#locationdescriptor). Usually this is a string or an object, with the following semantics:
9898

9999
* If it's a string it represents the absolute path to link to, e.g. `/users/123` (relative paths are not supported).
100100
* If it's an object it can have four keys:
@@ -591,9 +591,9 @@ For more details, please see the [histories guide](/docs/guides/Histories.md).
591591
`useRouterHistory` is a `history` enhancer that configures a given `createHistory` factory to work with React Router. This allows using custom histories in addition to the bundled singleton histories.
592592

593593
It also pre-enhances the history with the
594-
[useQueries](https://github.com/ReactJSTraining/history/blob/master/docs/QuerySupport.md)
594+
[useQueries](https://github.com/ReactTraining/history/blob/master/docs/QuerySupport.md)
595595
and
596-
[useBasename](https://github.com/ReactJSTraining/history/blob/master/docs/BasenameSupport.md)
596+
[useBasename](https://github.com/ReactTraining/history/blob/master/docs/BasenameSupport.md)
597597
enhancers from `history`
598598

599599
#### Example

docs/guides/Histories.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ render(
139139

140140
If you'd like to further customize the history options or use other
141141
enhancers from
142-
[history](https://github.com/ReactJSTraining/history/) you can use
142+
[history](https://github.com/ReactTraining/history/) you can use
143143
`useRouterHistory`.
144144

145145
Be aware that `useRouterHistory` already pre-enhances your history
146-
factory with the [useQueries](https://github.com/ReactJSTraining/history/blob/master/docs/QuerySupport.md) and [useBasename](https://github.com/ReactJSTraining/history/blob/master/docs/BasenameSupport.md) enhancers from `history`.
146+
factory with the [useQueries](https://github.com/ReactTraining/history/blob/master/docs/QuerySupport.md) and [useBasename](https://github.com/ReactTraining/history/blob/master/docs/BasenameSupport.md) enhancers from `history`.
147147

148148
### Examples:
149149

karma.conf.js

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
/*eslint no-console: 0*/
2-
var webpack = require('webpack')
3-
var path = require('path')
1+
const webpack = require('webpack')
2+
const path = require('path')
43

5-
module.exports = function (config) {
4+
module.exports = config => {
65
if (process.env.RELEASE)
76
config.singleRun = true
87

9-
var customLaunchers = {
8+
const customLaunchers = {
109
// Browsers to run on BrowserStack.
1110
BS_Chrome: {
1211
base: 'BrowserStack',
@@ -29,14 +28,14 @@ module.exports = function (config) {
2928
browser: 'safari',
3029
browser_version: '9.0'
3130
},
32-
BS_MobileSafari: {
31+
BS_MobileSafari8: {
3332
base: 'BrowserStack',
3433
os: 'ios',
3534
os_version: '8.3',
3635
browser: 'iphone',
3736
real_mobile: false
3837
},
39-
BS_MobileSafari: {
38+
BS_MobileSafari9: {
4039
base: 'BrowserStack',
4140
os: 'ios',
4241
os_version: '9.1',
@@ -65,29 +64,12 @@ module.exports = function (config) {
6564
}
6665
}
6766

68-
var isCi = process.env.CONTINUOUS_INTEGRATION === 'true'
69-
var runCoverage = process.env.COVERAGE === 'true' || isCi
70-
71-
var coverageLoaders = []
72-
var coverageReporters = []
73-
74-
if (runCoverage) {
75-
coverageLoaders.push({
76-
test: /\.js$/,
77-
include: path.resolve('modules/'),
78-
exclude: /__tests__/,
79-
loader: 'isparta'
80-
})
81-
82-
coverageReporters.push('coverage')
83-
}
84-
8567
config.set({
8668
customLaunchers: customLaunchers,
8769

8870
browsers: [ 'Chrome' ],
8971
frameworks: [ 'mocha' ],
90-
reporters: [ 'mocha' ].concat(coverageReporters),
72+
reporters: [ 'mocha', 'coverage' ],
9173

9274
files: [
9375
'tests.webpack.js'
@@ -98,11 +80,17 @@ module.exports = function (config) {
9880
},
9981

10082
webpack: {
101-
devtool: 'inline-source-map',
83+
devtool: 'cheap-module-inline-source-map',
10284
module: {
10385
loaders: [
104-
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
105-
].concat(coverageLoaders)
86+
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
87+
{
88+
test: /\.js$/,
89+
include: path.resolve('modules/'),
90+
exclude: /__tests__/,
91+
loader: 'isparta'
92+
}
93+
]
10694
},
10795
plugins: [
10896
new webpack.DefinePlugin({
@@ -132,7 +120,7 @@ module.exports = function (config) {
132120
config.captureTimeout = 120000
133121

134122
if (process.env.TRAVIS) {
135-
var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'
123+
const buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'
136124

137125
config.browserStack = {
138126
username: process.env.BROWSER_STACK_USERNAME,

modules/Link.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,38 +68,28 @@ const Link = React.createClass({
6868
},
6969

7070
handleClick(event) {
71+
if (this.props.onClick)
72+
this.props.onClick(event)
73+
74+
if (event.defaultPrevented)
75+
return
76+
7177
invariant(
7278
this.context.router,
73-
'<Link>s rendered outside of a router context cannot handle clicks.'
79+
'<Link>s rendered outside of a router context cannot navigate.'
7480
)
7581

76-
let allowTransition = true
77-
78-
if (this.props.onClick)
79-
this.props.onClick(event)
80-
8182
if (isModifiedEvent(event) || !isLeftClickEvent(event))
8283
return
8384

84-
if (event.defaultPrevented === true)
85-
allowTransition = false
86-
87-
// If target prop is set (e.g. to "_blank") let browser handle link.
85+
// If target prop is set (e.g. to "_blank"), let browser handle link.
8886
/* istanbul ignore if: untestable with Karma */
89-
if (this.props.target) {
90-
if (!allowTransition)
91-
event.preventDefault()
92-
87+
if (this.props.target)
9388
return
94-
}
9589

9690
event.preventDefault()
9791

98-
if (allowTransition) {
99-
const { to } = this.props
100-
101-
this.context.router.push(to)
102-
}
92+
this.context.router.push(this.props.to)
10393
},
10494

10595
render() {

modules/__tests__/shouldWarn.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/*eslint no-console: 0*/
2-
31
export default function shouldWarn(about) {
4-
console.error.expected.push(about)
2+
console.error.expected.push(about) // eslint-disable-line no-console
53
}

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build-es": "rimraf es6 && cross-env BABEL_ENV=es babel ./modules -d es6 --ignore '__tests__'",
2121
"build-umd": "cross-env BABEL_ENV=cjs NODE_ENV=development webpack modules/index.js umd/ReactRouter.js",
2222
"build-min": "cross-env BABEL_ENV=cjs NODE_ENV=production webpack -p modules/index.js umd/ReactRouter.min.js",
23-
"lint": "eslint modules examples",
23+
"lint": "eslint modules examples *.js",
2424
"start": "cross-env BABEL_ENV=cjs node examples/server.js",
2525
"test": "npm run lint && npm run test-node && npm run test-browser",
2626
"test-browser": "cross-env BABEL_ENV=cjs karma start",
@@ -44,7 +44,7 @@
4444
"devDependencies": {
4545
"babel-cli": "^6.10.1",
4646
"babel-core": "^6.10.4",
47-
"babel-eslint": "^6.1.0",
47+
"babel-eslint": "^6.1.2",
4848
"babel-loader": "^6.2.4",
4949
"babel-plugin-add-module-exports": "^0.2.1",
5050
"babel-plugin-dev-expression": "^0.2.1",
@@ -56,33 +56,33 @@
5656
"babel-register": "^6.9.0",
5757
"bundle-loader": "^0.5.4",
5858
"codecov.io": "^0.1.6",
59-
"coveralls": "^2.11.9",
60-
"cross-env": "^1.0.8",
59+
"coveralls": "^2.11.11",
60+
"cross-env": "^2.0.0",
6161
"css-loader": "^0.23.1",
62-
"eslint": "^3.0.0",
62+
"eslint": "^3.0.1",
6363
"eslint-config-rackt": "^1.1.1",
6464
"eslint-plugin-react": "^5.2.2",
6565
"expect": "^1.20.2",
6666
"express": "^4.14.0",
6767
"express-urlrewrite": "^1.2.0",
6868
"gzip-size": "^3.0.0",
6969
"isparta-loader": "^2.0.0",
70-
"karma": "^1.1.0",
70+
"karma": "^1.1.1",
7171
"karma-browserstack-launcher": "^1.0.1",
7272
"karma-chrome-launcher": "^1.0.1",
73-
"karma-coverage": "^1.0.0",
73+
"karma-coverage": "^1.1.0",
7474
"karma-mocha": "^1.1.1",
7575
"karma-mocha-reporter": "^2.0.4",
7676
"karma-sourcemap-loader": "^0.3.7",
7777
"karma-webpack": "^1.7.0",
7878
"mocha": "^2.5.3",
7979
"pretty-bytes": "^3.0.1",
8080
"qs": "^6.2.0",
81-
"react": "^15.2.0",
82-
"react-addons-css-transition-group": "^15.2.0",
83-
"react-addons-test-utils": "^15.2.0",
84-
"react-dom": "^15.2.0",
85-
"rimraf": "^2.5.2",
81+
"react": "^15.2.1",
82+
"react-addons-css-transition-group": "^15.2.1",
83+
"react-addons-test-utils": "^15.2.1",
84+
"react-dom": "^15.2.1",
85+
"rimraf": "^2.5.3",
8686
"style-loader": "^0.13.1",
8787
"webpack": "^1.13.1",
8888
"webpack-dev-middleware": "^1.6.1"

tests.webpack.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
/* eslint-disable no-console */
21
/* eslint-env mocha */
32

43
import expect from 'expect'
54

65
import { _resetWarned } from './modules/routerWarning'
76

87
beforeEach(() => {
8+
/* eslint-disable no-console */
99
expect.spyOn(console, 'error').andCall(msg => {
10-
for (const about of console.error.expected) {
10+
let expected = false
11+
12+
console.error.expected.forEach(about => {
1113
if (msg.indexOf(about) !== -1) {
1214
console.error.warned[about] = true
13-
return
15+
expected = true
1416
}
15-
}
17+
})
18+
19+
if (expected)
20+
return
1621

1722
console.error.threw = true
1823
throw new Error(msg)
@@ -21,18 +26,21 @@ beforeEach(() => {
2126
console.error.expected = []
2227
console.error.warned = Object.create(null)
2328
console.error.threw = false
29+
/* eslint-enable no-console */
2430
})
2531

2632
afterEach(() => {
27-
if (!console.error.threw) {
28-
console.error.expected.forEach(about => {
29-
expect(console.error.warned[about]).toExist(
30-
`Missing expected warning: ${about}`
31-
)
33+
/* eslint-disable no-console */
34+
const { threw, expected, warned } = console.error
35+
console.error.restore()
36+
37+
if (!threw) {
38+
expected.forEach(about => {
39+
expect(warned[about]).toExist(`Missing expected warning: ${about}`)
3240
})
3341
}
42+
/* eslint-enable no-console */
3443

35-
console.error.restore()
3644
_resetWarned()
3745
})
3846

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var webpack = require('webpack')
1+
const webpack = require('webpack')
22

33
module.exports = {
44

0 commit comments

Comments
 (0)