Unit testing controller which uses $state.transitionTo

后端 未结 3 1813
小蘑菇
小蘑菇 2021-01-11 10:02

within a controller i have a function which uses $state.transitionTo to \"redirect\" to another state.

now i am stuck in testing this function, i get al

3条回答
  •  情歌与酒
    2021-01-11 10:37

    Also if you want to expect on that the transition was made like so

    expect(state.current.name).toEqual('state-two')
    

    then you need to scope.$apply before the expect() for it to work

提交回复
热议问题