@@ -5,38 +5,38 @@ import ButtonLink from '../src/ButtonLink';
5
5
import Router , { Route , RouteHandler } from 'react-router' ;
6
6
import { Foo , Bar } from './TestHandlers' ;
7
7
import TestLocation from 'react-router/lib/locations/TestLocation' ;
8
- let { click } = React . addons . TestUtils . Simulate ;
8
+ const { click } = React . addons . TestUtils . Simulate ;
9
9
10
- describe ( 'A ButtonLink' , function ( ) {
11
- describe ( 'with params and a query' , function ( ) {
12
- it ( 'knows how to make its href' , function ( ) {
13
- let ButtonLinkHandler = React . createClass ( {
10
+ describe ( 'A ButtonLink' , function ( ) {
11
+ describe ( 'with params and a query' , function ( ) {
12
+ it ( 'knows how to make its href' , function ( ) {
13
+ const ButtonLinkHandler = React . createClass ( {
14
14
render ( ) {
15
15
return < ButtonLink to = "foo" params = { { bar : 'baz' } } query = { { qux : 'quux' } } > ButtonLink</ ButtonLink > ;
16
16
}
17
17
} ) ;
18
18
19
- let routes = [
19
+ const routes = [
20
20
< Route name = "foo" path = "foo/:bar" handler = { Foo } /> ,
21
21
< Route name = "link" handler = { ButtonLinkHandler } />
22
22
] ;
23
23
24
- let div = document . createElement ( 'div' ) ;
25
- let testLocation = new TestLocation ( ) ;
24
+ const div = document . createElement ( 'div' ) ;
25
+ const testLocation = new TestLocation ( ) ;
26
26
testLocation . history = [ '/link' ] ;
27
27
28
- Router . run ( routes , testLocation , function ( Handler ) {
29
- React . render ( < Handler /> , div , function ( ) {
30
- let a = div . querySelector ( 'a' ) ;
28
+ Router . run ( routes , testLocation , function ( Handler ) {
29
+ React . render ( < Handler /> , div , function ( ) {
30
+ const a = div . querySelector ( 'a' ) ;
31
31
expect ( a . getAttribute ( 'href' ) ) . to . equal ( '/foo/baz?qux=quux' ) ;
32
32
} ) ;
33
33
} ) ;
34
34
} ) ;
35
35
} ) ;
36
36
37
- describe ( 'when its route is active' , function ( ) {
38
- it ( 'has an active class name' , function ( done ) {
39
- let ButtonLinkHandler = React . createClass ( {
37
+ describe ( 'when its route is active' , function ( ) {
38
+ it ( 'has an active class name' , function ( done ) {
39
+ const ButtonLinkHandler = React . createClass ( {
40
40
render ( ) {
41
41
return (
42
42
< div >
@@ -52,25 +52,25 @@ describe('A ButtonLink', function () {
52
52
}
53
53
} ) ;
54
54
55
- let routes = (
55
+ const routes = (
56
56
< Route path = "/" handler = { ButtonLinkHandler } >
57
57
< Route name = "foo" handler = { Foo } />
58
58
< Route name = "bar" handler = { Bar } />
59
59
</ Route >
60
60
) ;
61
61
62
- let div = document . createElement ( 'div' ) ;
63
- let testLocation = new TestLocation ( ) ;
62
+ const div = document . createElement ( 'div' ) ;
63
+ const testLocation = new TestLocation ( ) ;
64
64
testLocation . history = [ '/foo' ] ;
65
- let steps = [ ] ;
65
+ const steps = [ ] ;
66
66
67
- function assertActive ( ) {
68
- let a = div . querySelector ( 'a' ) ;
67
+ function assertActive ( ) {
68
+ const a = div . querySelector ( 'a' ) ;
69
69
expect ( a . className . split ( ' ' ) . sort ( ) . join ( ' ' ) ) . to . equal ( 'active btn btn-primary btn-sm dontKillMe' ) ;
70
70
}
71
71
72
- function assertInactive ( ) {
73
- let a = div . querySelector ( 'a' ) ;
72
+ function assertInactive ( ) {
73
+ const a = div . querySelector ( 'a' ) ;
74
74
expect ( a . className . split ( ' ' ) . sort ( ) . join ( ' ' ) ) . to . equal ( 'btn btn-primary btn-sm dontKillMe' ) ;
75
75
}
76
76
@@ -89,17 +89,17 @@ describe('A ButtonLink', function () {
89
89
done ( ) ;
90
90
} ) ;
91
91
92
- Router . run ( routes , testLocation , function ( Handler ) {
92
+ Router . run ( routes , testLocation , function ( Handler ) {
93
93
React . render ( < Handler /> , div , ( ) => {
94
94
steps . shift ( ) ( ) ;
95
95
} ) ;
96
96
} ) ;
97
97
} ) ;
98
98
} ) ;
99
99
100
- describe ( 'when clicked' , function ( ) {
101
- it ( 'calls a user defined click handler' , function ( done ) {
102
- let ButtonLinkHandler = React . createClass ( {
100
+ describe ( 'when clicked' , function ( ) {
101
+ it ( 'calls a user defined click handler' , function ( done ) {
102
+ const ButtonLinkHandler = React . createClass ( {
103
103
handleClick ( event ) {
104
104
assert . ok ( true ) ;
105
105
done ( ) ;
@@ -110,27 +110,27 @@ describe('A ButtonLink', function () {
110
110
}
111
111
} ) ;
112
112
113
- let routes = [
113
+ const routes = [
114
114
< Route name = "foo" handler = { Foo } /> ,
115
115
< Route name = "link" handler = { ButtonLinkHandler } />
116
116
] ;
117
- let div = document . createElement ( 'div' ) ;
118
- let testLocation = new TestLocation ( ) ;
117
+ const div = document . createElement ( 'div' ) ;
118
+ const testLocation = new TestLocation ( ) ;
119
119
testLocation . history = [ '/link' ] ;
120
120
121
- Router . run ( routes , testLocation , function ( Handler ) {
122
- React . render ( < Handler /> , div , function ( ) {
121
+ Router . run ( routes , testLocation , function ( Handler ) {
122
+ React . render ( < Handler /> , div , function ( ) {
123
123
click ( div . querySelector ( 'a' ) ) ;
124
124
} ) ;
125
125
} ) ;
126
126
} ) ;
127
127
128
- it ( 'transitions to the correct route' , function ( done ) {
129
- let div = document . createElement ( 'div' ) ;
130
- let testLocation = new TestLocation ( ) ;
128
+ it ( 'transitions to the correct route' , function ( done ) {
129
+ const div = document . createElement ( 'div' ) ;
130
+ const testLocation = new TestLocation ( ) ;
131
131
testLocation . history = [ '/link' ] ;
132
132
133
- let ButtonLinkHandler = React . createClass ( {
133
+ const ButtonLinkHandler = React . createClass ( {
134
134
handleClick ( ) {
135
135
// just here to make sure click handlers don't prevent it from happening
136
136
} ,
@@ -140,29 +140,27 @@ describe('A ButtonLink', function () {
140
140
}
141
141
} ) ;
142
142
143
- let routes = [
143
+ const routes = [
144
144
< Route name = "foo" handler = { Foo } /> ,
145
145
< Route name = "link" handler = { ButtonLinkHandler } />
146
146
] ;
147
147
148
- let steps = [ ] ;
148
+ const steps = [ ] ;
149
149
150
- steps . push ( function ( ) {
150
+ steps . push ( function ( ) {
151
151
click ( div . querySelector ( 'a' ) , { button : 0 } ) ;
152
152
} ) ;
153
153
154
- steps . push ( function ( ) {
154
+ steps . push ( function ( ) {
155
155
expect ( div . innerHTML ) . to . match ( / F o o / ) ;
156
156
done ( ) ;
157
157
} ) ;
158
158
159
- Router . run ( routes , testLocation , function ( Handler ) {
160
- React . render ( < Handler /> , div , function ( ) {
159
+ Router . run ( routes , testLocation , function ( Handler ) {
160
+ React . render ( < Handler /> , div , function ( ) {
161
161
steps . shift ( ) ( ) ;
162
162
} ) ;
163
163
} ) ;
164
164
} ) ;
165
-
166
165
} ) ;
167
-
168
166
} ) ;
0 commit comments