diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js')
-rw-r--r-- | spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js b/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js index 168ddcfeacc..403d0dce3fc 100644 --- a/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js +++ b/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js @@ -1,3 +1,4 @@ +import { GlModal } from '@gitlab/ui'; import { createLocalVue, mount } from '@vue/test-utils'; import Vuex from 'vuex'; import DeployFreezeTable from '~/deploy_freeze/components/deploy_freeze_table.vue'; @@ -29,6 +30,8 @@ describe('Deploy freeze table', () => { const findAddDeployFreezeButton = () => wrapper.find('[data-testid="add-deploy-freeze"]'); const findEditDeployFreezeButton = () => wrapper.find('[data-testid="edit-deploy-freeze"]'); const findDeployFreezeTable = () => wrapper.find('[data-testid="deploy-freeze-table"]'); + const findDeleteDeployFreezeButton = () => wrapper.find('[data-testid="delete-deploy-freeze"]'); + const findDeleteDeployFreezeModal = () => wrapper.findComponent(GlModal); beforeEach(() => { createComponent(); @@ -73,6 +76,29 @@ describe('Deploy freeze table', () => { store.state.freezePeriods[0], ); }); + + it('displays delete deploy freeze button', () => { + expect(findDeleteDeployFreezeButton().exists()).toBe(true); + }); + + it('confirms a user wants to delete a deploy freeze', async () => { + const [{ freezeStart, freezeEnd, cronTimezone }] = store.state.freezePeriods; + await findDeleteDeployFreezeButton().trigger('click'); + const modal = findDeleteDeployFreezeModal(); + expect(modal.text()).toContain( + `Deploy freeze from ${freezeStart} to ${freezeEnd} in ${cronTimezone.formattedTimezone} will be removed.`, + ); + }); + + it('deletes the freeze period on confirmation', async () => { + await findDeleteDeployFreezeButton().trigger('click'); + const modal = findDeleteDeployFreezeModal(); + modal.vm.$emit('primary'); + expect(store.dispatch).toHaveBeenCalledWith( + 'deleteFreezePeriod', + store.state.freezePeriods[0], + ); + }); }); }); |