File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ describe('withRouter', function () {
11
11
class App extends Component {
12
12
render ( ) {
13
13
expect ( this . props . router ) . toExist ( )
14
- return < h1 > App </ h1 >
14
+ return < h1 > { this . props . router . location . pathname } </ h1 >
15
15
}
16
16
}
17
17
@@ -39,4 +39,34 @@ describe('withRouter', function () {
39
39
done ( )
40
40
} )
41
41
} )
42
+
43
+ it ( 'updates the context inside static containers' , function ( done ) {
44
+ const WrappedApp = withRouter ( App )
45
+
46
+ class StaticContainer extends Component {
47
+ shouldComponentUpdate ( ) {
48
+ return false
49
+ }
50
+
51
+ render ( ) {
52
+ return this . props . children
53
+ }
54
+ }
55
+
56
+ const history = createHistory ( '/' )
57
+
58
+ render ( (
59
+ < Router history = { history } >
60
+ < Route component = { StaticContainer } >
61
+ < Route path = "/" component = { WrappedApp } />
62
+ < Route path = "/hello" component = { WrappedApp } />
63
+ </ Route >
64
+ </ Router >
65
+ ) , node , function ( ) {
66
+ expect ( node . firstChild . textContent ) . toEqual ( '/' )
67
+ history . push ( '/hello' )
68
+ expect ( node . firstChild . textContent ) . toEqual ( '/hello' )
69
+ done ( )
70
+ } )
71
+ } )
42
72
} )
You can’t perform that action at this time.
0 commit comments