Skip to content

Commit 4ed7851

Browse files
committed
Add test for <Link> on HashHistory
1 parent 5d674c9 commit 4ed7851

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

modules/__tests__/Link-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import expect from 'expect';
33
import React, { render } from 'react/addons';
44
import Router from '../Router';
55
import MemoryHistory from '../MemoryHistory';
6+
import HashHistory from '../HashHistory';
67
import Route from '../Route';
78
import Link from '../Link';
89

@@ -55,6 +56,23 @@ describe('A <Link>', function () {
5556
});
5657
});
5758

59+
it('knows how to make its href with HashHistory', function () {
60+
var LinkWrapper = React.createClass({
61+
render() {
62+
return <Link to="/hello/michael" query={{the: 'query'}}>Link</Link>;
63+
}
64+
});
65+
66+
render((
67+
<Router history={new HashHistory()}>
68+
<Route path="/" component={LinkWrapper}/>
69+
</Router>
70+
), div, function () {
71+
var a = div.querySelector('a');
72+
expect(a.getAttribute('href')).toEqual('/#/hello/michael?the=query');
73+
});
74+
});
75+
5876
describe('with params', function () {
5977
var App = React.createClass({
6078
render() {

0 commit comments

Comments
 (0)