diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js')
-rw-r--r-- | spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js b/spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js new file mode 100644 index 00000000000..5ec1b7b7932 --- /dev/null +++ b/spec/frontend/jira_connect/subscriptions/components/add_namespace_button_spec.js @@ -0,0 +1,44 @@ +import { GlButton } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; +import AddNamespaceButton from '~/jira_connect/subscriptions/components/add_namespace_button.vue'; +import AddNamespaceModal from '~/jira_connect/subscriptions/components/add_namespace_modal/add_namespace_modal.vue'; +import { ADD_NAMESPACE_MODAL_ID } from '~/jira_connect/subscriptions/constants'; +import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; + +describe('AddNamespaceButton', () => { + let wrapper; + + const createComponent = () => { + wrapper = shallowMount(AddNamespaceButton, { + directives: { + glModal: createMockDirective(), + }, + }); + }; + + const findButton = () => wrapper.findComponent(GlButton); + const findModal = () => wrapper.findComponent(AddNamespaceModal); + + beforeEach(() => { + createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('displays a button', () => { + expect(findButton().exists()).toBe(true); + }); + + it('contains a modal', () => { + expect(findModal().exists()).toBe(true); + }); + + it('button is bound to the modal', () => { + const { value } = getBinding(findButton().element, 'gl-modal'); + + expect(value).toBeTruthy(); + expect(value).toBe(ADD_NAMESPACE_MODAL_ID); + }); +}); |