From d49807b27ed22be47b7e9a29f1c7dc1ae33009e0 Mon Sep 17 00:00:00 2001 From: JVB <1976577+jvb93@users.noreply.github.com> Date: Fri, 12 Jan 2018 11:00:59 -0800 Subject: [PATCH] added unit test --- test/unit/specs/FormWizard.spec.js | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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})