Skip to content

Commit 3b21c87

Browse files
committed
Add a breaking test.
1 parent ac7dd4a commit 3b21c87

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

modules/__tests__/Link-test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*eslint-env mocha */
22
/*eslint react/prop-types: 0*/
3-
import expect from 'expect'
3+
import expect, { spyOn } from 'expect'
44
import React, { Component } from 'react'
5-
import ReactTestUtils from 'react-addons-test-utils'
5+
import { Simulate } from 'react-addons-test-utils'
66
import { render } from 'react-dom'
77
import createHistory from 'history/lib/createMemoryHistory'
88
import execSteps from './execSteps'
99
import Router from '../Router'
1010
import Route from '../Route'
1111
import Link from '../Link'
1212

13-
const { click } = ReactTestUtils.Simulate
13+
const { click } = Simulate
1414

1515
describe('A <Link>', function () {
1616

@@ -289,23 +289,27 @@ describe('A <Link>', function () {
289289
// just here to make sure click handlers don't prevent it from happening
290290
}
291291
render() {
292-
return <Link to="/hello" onClick={(e) => this.handleClick(e)}>Link</Link>
292+
return <Link to="/hello" hash="#world" onClick={(e) => this.handleClick(e)}>Link</Link>
293293
}
294294
}
295295

296+
const history = createHistory('/')
297+
const spy = spyOn(history, 'pushState').andCallThrough()
298+
296299
const steps = [
297300
function () {
298301
click(node.querySelector('a'), { button: 0 })
299302
},
300303
function () {
301304
expect(node.innerHTML).toMatch(/Hello/)
305+
expect(spy).toHaveBeenCalledWith(undefined, '/hello#world')
302306
}
303307
]
304308

305309
const execNextStep = execSteps(steps, done)
306310

307311
render((
308-
<Router history={createHistory('/')} onUpdate={execNextStep}>
312+
<Router history={history} onUpdate={execNextStep}>
309313
<Route path="/" component={LinkWrapper} />
310314
<Route path="/hello" component={Hello} />
311315
</Router>

0 commit comments

Comments
 (0)