diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js b/spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js deleted file mode 100644 index 93edaaa400d..00000000000 --- a/spec/frontend/vue_shared/components/members/action_buttons/approve_access_request_button_spec.js +++ /dev/null @@ -1,74 +0,0 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import Vuex from 'vuex'; -import { GlButton, GlForm } from '@gitlab/ui'; -import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; -import ApproveAccessRequestButton from '~/vue_shared/components/members/action_buttons/approve_access_request_button.vue'; - -jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); - -const localVue = createLocalVue(); -localVue.use(Vuex); - -describe('ApproveAccessRequestButton', () => { - let wrapper; - - const createStore = (state = {}) => { - return new Vuex.Store({ - state: { - memberPath: '/groups/foo-bar/-/group_members/:id', - ...state, - }, - }); - }; - - const createComponent = (propsData = {}, state) => { - wrapper = shallowMount(ApproveAccessRequestButton, { - localVue, - store: createStore(state), - propsData: { - memberId: 1, - ...propsData, - }, - directives: { - GlTooltip: createMockDirective(), - }, - }); - }; - - const findForm = () => wrapper.find(GlForm); - const findButton = () => findForm().find(GlButton); - - beforeEach(() => { - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('displays a tooltip', () => { - const button = findButton(); - - expect(getBinding(button.element, 'gl-tooltip')).not.toBeUndefined(); - expect(button.attributes('title')).toBe('Grant access'); - }); - - it('sets `aria-label` attribute', () => { - expect(findButton().attributes('aria-label')).toBe('Grant access'); - }); - - it('submits the form when button is clicked', () => { - expect(findButton().attributes('type')).toBe('submit'); - }); - - it('displays form with correct action and inputs', () => { - const form = findForm(); - - expect(form.attributes('action')).toBe( - '/groups/foo-bar/-/group_members/1/approve_access_request', - ); - expect(form.find('input[name="authenticity_token"]').attributes('value')).toBe( - 'mock-csrf-token', - ); - }); -}); |