@@ -86,14 +86,31 @@ describe('FormWizard.vue', () => {
86
86
const formWizard = wizard . find ( FormWizard )
87
87
expect ( formWizard . vm . activeTabIndex ) . to . equal ( startIndex )
88
88
} )
89
+ it ( 'resets wizard' , ( ) => {
90
+ const wizard = mount ( twoStepWizard , { localVue} )
91
+ const wizardInstance = wizard . find ( FormWizard )
92
+ let tabs = wizard . findAll ( WizardTab )
93
+ expect ( tabs . length ) . to . equal ( 3 )
94
+ wizardInstance . vm . nextTab ( )
95
+ wizardInstance . vm . nextTab ( )
96
+ const lastTab = tabs . at ( 2 )
97
+ expect ( lastTab . vm . active ) . to . equal ( true )
98
+ expect ( wizardInstance . vm . maxStep ) . to . equal ( tabs . length - 1 )
99
+ expect ( wizardInstance . vm . activeTabIndex ) . to . equal ( tabs . length - 1 )
100
+ wizardInstance . vm . reset ( )
101
+ const firstTab = tabs . at ( 0 )
102
+ expect ( firstTab . vm . active ) . to . equal ( true )
103
+ expect ( wizardInstance . vm . maxStep ) . to . equal ( 0 )
104
+ expect ( wizardInstance . vm . activeTabIndex ) . to . equal ( 0 )
105
+ } )
106
+
89
107
it ( 'next tab is called' , ( ) => {
90
108
const wizard = mount ( twoStepWizard , { localVue} )
91
- const nextTabHandler = sinon . stub ( )
92
- const formWizard = wizard . find ( FormWizard )
93
- formWizard . setMethods ( { nextTab : nextTabHandler } )
94
109
const nextButton = wizard . find ( '.wizard-footer-right span' )
95
110
nextButton . trigger ( 'click' )
96
- expect ( nextTabHandler . called ) . to . equal ( true )
111
+ let tabs = wizard . findAll ( WizardTab )
112
+ const secondTab = tabs . at ( 1 )
113
+ expect ( secondTab . vm . active ) . to . equal ( true )
97
114
} )
98
115
99
116
it ( 'renders tab wrapped in another element' , done => {
@@ -109,4 +126,5 @@ describe('FormWizard.vue', () => {
109
126
done ( )
110
127
} )
111
128
} )
129
+
112
130
} )
0 commit comments