@@ -107,6 +107,7 @@ describe('<UISrefActive>', () => {
107107 </ UIRouter > ,
108108 ) ;
109109 return router . stateService . go ( 'simple' ) . then ( ( ) => {
110+ wrapper . update ( ) ;
110111 const props = wrapper . find ( 'a' ) . props ( ) ;
111112 expect ( typeof props . onClick ) . toBe ( 'function' ) ;
112113 expect ( props . href . includes ( '/child1' ) ) . toBe ( true ) ;
@@ -122,12 +123,14 @@ describe('<UISrefActive>', () => {
122123 return router . stateService
123124 . go ( 'parent.child1' )
124125 . then ( ( ) => {
126+ wrapper . update ( ) ;
125127 const activeLink = wrapper . find ( 'a.active' ) ;
126128 expect ( activeLink . length ) . toBe ( 1 ) ;
127129 expect ( activeLink . props ( ) . href . includes ( '/child1' ) ) . toBe ( true ) ;
128130 return router . stateService . go ( 'parent.child2' ) ;
129131 } )
130132 . then ( ( ) => {
133+ wrapper . update ( ) ;
131134 const activeLink = wrapper . find ( 'a.active' ) ;
132135 expect ( activeLink . length ) . toBe ( 1 ) ;
133136 expect ( activeLink . props ( ) . href . includes ( '/child2' ) ) . toBe ( true ) ;
@@ -145,6 +148,7 @@ describe('<UISrefActive>', () => {
145148 </ UIRouter > ,
146149 ) ;
147150 return router . stateService . go ( 'throw' ) . then ( ( ) => {
151+ wrapper . update ( ) ;
148152 expect ( spy . called ) . toBe ( true ) ;
149153 } ) ;
150154 } ) ;
@@ -159,11 +163,13 @@ describe('<UISrefActive>', () => {
159163 return router . stateService
160164 . go ( 'simple' )
161165 . then ( ( ) => {
162- node = wrapper . find ( UISrefActive ) . get ( 0 ) ;
163- spy = sinon . spy ( node , 'deregister' ) ;
166+ wrapper . update ( ) ;
167+ node = wrapper . find ( UISrefActive ) . at ( 0 ) ;
168+ spy = sinon . spy ( node . instance ( ) , 'deregister' ) ;
164169 return router . stateService . go ( 'simple2' ) ;
165170 } )
166171 . then ( ( ) => {
172+ wrapper . update ( ) ;
167173 expect ( spy . called ) . toBe ( true ) ;
168174 } ) ;
169175 } ) ;
@@ -184,11 +190,13 @@ describe('<UISrefActive>', () => {
184190 return router . stateService
185191 . go ( 'withParams' , { param : 5 } )
186192 . then ( ( ) => {
193+ wrapper . update ( ) ;
187194 const activeLink = wrapper . find ( 'a.active' ) ;
188195 expect ( activeLink . length ) . toBe ( 1 ) ;
189196 return router . stateService . go ( 'withParams' , { param : 3 } ) ;
190197 } )
191198 . then ( ( ) => {
199+ wrapper . update ( ) ;
192200 const activeLink = wrapper . find ( 'a.active' ) ;
193201 expect ( activeLink . length ) . toBe ( 0 ) ;
194202 } ) ;
@@ -204,9 +212,9 @@ describe('<UISrefActive>', () => {
204212 </ UISrefActive >
205213 </ UIRouter > ,
206214 ) ;
207- let node = wrapper . find ( UISrefActive ) . node ;
208- expect ( node . context . parentUIViewAddress ) . toBeUndefined ( ) ;
209- expect ( node . states [ 0 ] . state . name ) . toBe ( 'parent.child1' ) ;
215+ let node = wrapper . find ( UISrefActive ) . at ( 0 ) ;
216+ expect ( node . instance ( ) . context . parentUIViewAddress ) . toBeUndefined ( ) ;
217+ expect ( node . instance ( ) . states [ 0 ] . state . name ) . toBe ( 'parent.child1' ) ;
210218 } ) ;
211219
212220 it ( 'works with multiple <UISref> children' , ( ) => {
@@ -227,9 +235,9 @@ describe('<UISrefActive>', () => {
227235 </ UISrefActive >
228236 </ UIRouter > ,
229237 ) ;
230- let node = wrapper . find ( UISrefActive ) . node ;
231- expect ( node . context . parentUIViewAddress ) . toBeUndefined ( ) ;
232- expect ( node . states . length ) . toBe ( 3 ) ;
238+ const node = wrapper . find ( UISrefActive ) . at ( 0 ) ;
239+ expect ( node . instance ( ) . context . parentUIViewAddress ) . toBeUndefined ( ) ;
240+ expect ( node . instance ( ) . states . length ) . toBe ( 3 ) ;
233241 } ) ;
234242
235243 it ( "removes active state of UISref when it's unmounted" , ( ) => {
@@ -244,10 +252,10 @@ describe('<UISrefActive>', () => {
244252 </ UISrefActive >
245253 </ UIRouter > ;
246254 const wrapper = mount ( < Comp show = { true } /> ) ;
247- const node = wrapper . find ( UISrefActive ) . get ( 0 ) ;
248- expect ( node . states . length ) . toBe ( 1 ) ;
255+ const node = wrapper . find ( UISrefActive ) . at ( 0 ) ;
256+ expect ( node . instance ( ) . states . length ) . toBe ( 1 ) ;
249257 wrapper . setProps ( { show : false } ) ;
250- expect ( node . states . length ) . toBe ( 0 ) ;
258+ expect ( node . instance ( ) . states . length ) . toBe ( 0 ) ;
251259 } ) ;
252260
253261 it ( 'checks for exact state match when exact prop is provided' , ( ) => {
@@ -279,10 +287,12 @@ describe('<UISrefActive>', () => {
279287 return router . stateService
280288 . go ( '_parent._child' )
281289 . then ( ( ) => {
290+ wrapper . update ( ) ;
282291 expect ( wrapper . find ( 'a.active' ) . length ) . toBe ( 1 ) ;
283292 return router . stateService . go ( '_parent' ) ;
284293 } )
285294 . then ( ( ) => {
295+ wrapper . update ( ) ;
286296 expect ( wrapper . find ( 'a.active' ) . length ) . toBe ( 2 ) ;
287297 } ) ;
288298 } ) ;
0 commit comments