@@ -84,12 +84,16 @@ describe('Routing', function() {
84
84
85
85
var App = React . createClass ( {
86
86
87
+ getInitialState : function ( ) {
88
+ return { } ;
89
+ } ,
90
+
87
91
render : function ( ) {
88
- return div ( { onClick : this . props . onClick } ,
92
+ return div ( { onClick : this . state . onClick } ,
89
93
Locations ( {
90
94
ref : 'router' , className : 'App' ,
91
- onNavigation : this . props . navigationHandler ,
92
- onBeforeNavigation : this . props . beforeNavigationHandler
95
+ onNavigation : this . state . navigationHandler ,
96
+ onBeforeNavigation : this . state . beforeNavigationHandler
93
97
} ,
94
98
Location ( {
95
99
path : '/__zuul' ,
@@ -140,8 +144,8 @@ describe('Routing', function() {
140
144
} ,
141
145
142
146
gotoURL : function ( url ) {
143
- if ( this . props . gotoURL ) {
144
- this . props . gotoURL ( url ) ;
147
+ if ( this . state . gotoURL ) {
148
+ this . state . gotoURL ( url ) ;
145
149
}
146
150
} ,
147
151
@@ -229,7 +233,7 @@ describe('Routing', function() {
229
233
it ( 'calls onBeforeNaviation and onNavigation' , function ( done ) {
230
234
assertRendered ( 'mainpage' ) ;
231
235
var called = [ ] ;
232
- app . setProps ( {
236
+ app . setState ( {
233
237
beforeNavigationHandler : function ( nextPath ) {
234
238
called . push ( nextPath ) ;
235
239
} ,
@@ -294,7 +298,7 @@ describe('Routing', function() {
294
298
295
299
var assertNotNavigated = function ( done ) {
296
300
assertRendered ( 'mainpage' ) ;
297
- app . setProps ( {
301
+ app . setState ( {
298
302
onClick : function ( event ) {
299
303
// Make sure that the event hasn't had its default prevented by the
300
304
// CaptureClicks component.
@@ -339,7 +343,7 @@ describe('Routing', function() {
339
343
340
344
it ( "doesn't navigate if the href has another host" , function ( done ) {
341
345
assertRendered ( 'mainpage' ) ;
342
- app . setProps ( {
346
+ app . setState ( {
343
347
onClick : function ( event ) {
344
348
// Make sure that the event hasn't had its default prevented by the
345
349
// CaptureClicks component.
@@ -354,7 +358,7 @@ describe('Routing', function() {
354
358
355
359
it ( 'follows the link if the href has no matching route' , function ( done ) {
356
360
assertRendered ( 'mainpage' ) ;
357
- app . setProps ( {
361
+ app . setState ( {
358
362
gotoURL : function ( url ) {
359
363
done ( ) ;
360
364
}
@@ -365,7 +369,7 @@ describe('Routing', function() {
365
369
it ( 'doesn\'t route bare hash links' , function ( done ) {
366
370
assertRendered ( 'mainpage' ) ;
367
371
var called = false ;
368
- app . setProps ( {
372
+ app . setState ( {
369
373
gotoURL : function ( url ) {
370
374
called = true ;
371
375
done ( ) ;
@@ -456,7 +460,7 @@ describe('Nested routers', function() {
456
460
describe ( 'CaptureClicks component' , function ( ) {
457
461
it ( 'navigates to a subroute via onClick event' , function ( done ) {
458
462
assertRendered ( 'mainpage' ) ;
459
- app . setProps ( {
463
+ app . setState ( {
460
464
gotoURL : function ( url ) {
461
465
done ( new Error ( 'Followed link to ' + url ) ) ;
462
466
}
@@ -470,7 +474,7 @@ describe('Nested routers', function() {
470
474
471
475
it ( 'navigates to a subroute via onClick event (root case)' , function ( done ) {
472
476
assertRendered ( 'mainpage' ) ;
473
- app . setProps ( {
477
+ app . setState ( {
474
478
gotoURL : function ( url ) {
475
479
done ( new Error ( 'Followed link to ' + url ) ) ;
476
480
}
0 commit comments