diff --git a/test/unit/specs/FormWizard.spec.js b/test/unit/specs/FormWizard.spec.js index eece905..1a72599 100644 --- a/test/unit/specs/FormWizard.spec.js +++ b/test/unit/specs/FormWizard.spec.js @@ -386,6 +386,50 @@ describe('FormWizard.vue', () => { }) }) }) + describe('after change', () => { + beforeEach(() => { + threeStepWizard = { + template: ` + + My first tab content + + + My second tab content + + + My third tab content + + `, + methods: { + validationMethod, + } + } + }) + it('simple method on after change', () => { + threeStepWizard.methods.validationMethod = sinon.stub() + threeStepWizard.methods.validationMethod.returns(null) + const wizard = mount(threeStepWizard, {localVue}) + const wizardInstance = wizard.find(FormWizard) + wizardInstance.vm.nextTab() + expect(threeStepWizard.methods.validationMethod).to.have.been.called() + expect(wizardInstance.vm.activeTabIndex).to.equal(1) + }) + it('simple method on back navigation after change', () => { + threeStepWizard.methods.validationMethod = sinon.stub() + threeStepWizard.methods.validationMethod.returns(null) + const wizard = mount(threeStepWizard, {localVue}) + const wizardInstance = wizard.find(FormWizard) + wizardInstance.vm.nextTab() + wizardInstance.vm.prevTab() + expect(threeStepWizard.methods.validationMethod.called) + }) + }) describe('with vue-router', ()=> { it('renders correct tab contents', () => { const wizard = mount(routerWizard, {localVue, router})