diff options
Diffstat (limited to 'spec/frontend/pages/admin')
3 files changed, 3 insertions, 91 deletions
diff --git a/spec/frontend/pages/admin/users/components/__snapshots__/user_operation_confirmation_modal_spec.js.snap b/spec/frontend/pages/admin/users/components/__snapshots__/user_operation_confirmation_modal_spec.js.snap deleted file mode 100644 index dbf8caae357..00000000000 --- a/spec/frontend/pages/admin/users/components/__snapshots__/user_operation_confirmation_modal_spec.js.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`User Operation confirmation modal renders modal with form included 1`] = ` -<gl-modal-stub - modalclass="" - modalid="user-operation-modal" - ok-title="action" - ok-variant="warning" - size="md" - title="title" - titletag="h4" -> - <form - action="/url" - method="post" - > - <span> - content - </span> - - <input - name="_method" - type="hidden" - value="method" - /> - - <input - name="authenticity_token" - type="hidden" - value="csrf" - /> - </form> -</gl-modal-stub> -`; diff --git a/spec/frontend/pages/admin/users/components/user_modal_manager_spec.js b/spec/frontend/pages/admin/users/components/user_modal_manager_spec.js index 3d615d9d05f..6df2efd624d 100644 --- a/spec/frontend/pages/admin/users/components/user_modal_manager_spec.js +++ b/spec/frontend/pages/admin/users/components/user_modal_manager_spec.js @@ -14,21 +14,18 @@ describe('Users admin page Modal Manager', () => { }, }; - const actionModals = { - action1: ModalStub, - action2: ModalStub, - }; - let wrapper; const createComponent = (props = {}) => { wrapper = mount(UserModalManager, { propsData: { - actionModals, modalConfiguration, csrfToken: 'dummyCSRF', ...props, }, + stubs: { + DeleteUserModal: ModalStub, + }, }); }; @@ -43,11 +40,6 @@ describe('Users admin page Modal Manager', () => { expect(wrapper.find({ ref: 'modal' }).exists()).toBeFalsy(); }); - it('throws if non-existing action is requested', () => { - createComponent(); - expect(() => wrapper.vm.show({ glModalAction: 'non-existing' })).toThrow(); - }); - it('throws if action has no proper configuration', () => { createComponent({ modalConfiguration: {}, diff --git a/spec/frontend/pages/admin/users/components/user_operation_confirmation_modal_spec.js b/spec/frontend/pages/admin/users/components/user_operation_confirmation_modal_spec.js deleted file mode 100644 index f3a37a255cd..00000000000 --- a/spec/frontend/pages/admin/users/components/user_operation_confirmation_modal_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import { GlModal } from '@gitlab/ui'; -import UserOperationConfirmationModal from '~/pages/admin/users/components/user_operation_confirmation_modal.vue'; - -describe('User Operation confirmation modal', () => { - let wrapper; - - const createComponent = (props = {}) => { - wrapper = shallowMount(UserOperationConfirmationModal, { - propsData: { - title: 'title', - content: 'content', - action: 'action', - url: '/url', - username: 'username', - csrfToken: 'csrf', - method: 'method', - ...props, - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - - it('renders modal with form included', () => { - createComponent(); - expect(wrapper.element).toMatchSnapshot(); - }); - - it('closing modal with ok button triggers form submit', () => { - createComponent(); - const form = wrapper.find('form'); - jest.spyOn(form.element, 'submit').mockReturnValue(); - wrapper.find(GlModal).vm.$emit('ok'); - return wrapper.vm.$nextTick().then(() => { - expect(form.element.submit).toHaveBeenCalled(); - expect(form.element.action).toContain(wrapper.props('url')); - expect(new FormData(form.element).get('authenticity_token')).toEqual( - wrapper.props('csrfToken'), - ); - }); - }); -}); |