diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/frontend/whats_new/components/app_spec.js | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/frontend/whats_new/components/app_spec.js')
-rw-r--r-- | spec/frontend/whats_new/components/app_spec.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/frontend/whats_new/components/app_spec.js b/spec/frontend/whats_new/components/app_spec.js new file mode 100644 index 00000000000..a349aad9f1c --- /dev/null +++ b/spec/frontend/whats_new/components/app_spec.js @@ -0,0 +1,57 @@ +import { createLocalVue, mount } from '@vue/test-utils'; +import Vuex from 'vuex'; +import { GlDrawer } from '@gitlab/ui'; +import App from '~/whats_new/components/app.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +describe('App', () => { + let wrapper; + let store; + let actions; + let state; + + beforeEach(() => { + actions = { + closeDrawer: jest.fn(), + }; + + state = { + open: true, + }; + + store = new Vuex.Store({ + actions, + state, + }); + + wrapper = mount(App, { + localVue, + store, + }); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + const getDrawer = () => wrapper.find(GlDrawer); + + it('contains a drawer', () => { + expect(getDrawer().exists()).toBe(true); + }); + + it('dispatches closeDrawer when clicking close', () => { + getDrawer().vm.$emit('close'); + expect(actions.closeDrawer).toHaveBeenCalled(); + }); + + it.each([true, false])('passes open property', async openState => { + wrapper.vm.$store.state.open = openState; + + await wrapper.vm.$nextTick(); + + expect(getDrawer().props('open')).toBe(openState); + }); +}); |