Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 21:11:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 21:11:16 +0300
commitb9b3924a96ef04cf1aa1b7570e2f69bfd8904602 (patch)
treec2d8b9f68629c8c254157c636f469547e04380ad /spec/frontend/branches
parent4e752429e6173020567f9509f1fa993cc82a258a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/branches')
-rw-r--r--spec/frontend/branches/components/delete_branch_modal_spec.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/frontend/branches/components/delete_branch_modal_spec.js b/spec/frontend/branches/components/delete_branch_modal_spec.js
index 2b8c8d408c4..c977868ca93 100644
--- a/spec/frontend/branches/components/delete_branch_modal_spec.js
+++ b/spec/frontend/branches/components/delete_branch_modal_spec.js
@@ -46,6 +46,7 @@ const findDeleteButton = () => wrapper.findByTestId('delete-branch-confirmation-
const findCancelButton = () => wrapper.findByTestId('delete-branch-cancel-button');
const findFormInput = () => wrapper.findComponent(GlFormInput);
const findForm = () => wrapper.find('form');
+const submitFormSpy = () => jest.spyOn(wrapper.vm.$refs.form, 'submit');
describe('Delete branch modal', () => {
const expectedUnmergedWarning =
@@ -73,12 +74,10 @@ describe('Delete branch modal', () => {
});
it('submits the form when the delete button is clicked', () => {
- const submitFormSpy = jest.spyOn(wrapper.vm.$refs.form, 'submit');
-
findDeleteButton().trigger('click');
expect(findForm().attributes('action')).toBe(deletePath);
- expect(submitFormSpy).toHaveBeenCalled();
+ expect(submitFormSpy()).toHaveBeenCalled();
});
it('calls show on the modal when a `openModal` event is received through the event hub', async () => {
@@ -136,7 +135,18 @@ describe('Delete branch modal', () => {
});
});
- it('opens with the delete button disabled and enables it when branch name is confirmed', async () => {
+ it('opens with the delete button disabled and doesn`t fire submit when clicked or pressed enter', async () => {
+ expect(findDeleteButton().props('disabled')).toBe(true);
+
+ findFormInput().vm.$emit('input', 'hello');
+
+ await waitForPromises();
+
+ findDeleteButton().trigger('click');
+ expect(submitFormSpy()).not.toHaveBeenCalled();
+ });
+
+ it('opens with the delete button disabled and enables it when branch name is confirmed and fires submit', async () => {
expect(findDeleteButton().props('disabled')).toBe(true);
findFormInput().vm.$emit('input', branchName);
@@ -144,6 +154,9 @@ describe('Delete branch modal', () => {
await waitForPromises();
expect(findDeleteButton().props('disabled')).not.toBe(true);
+
+ findDeleteButton().trigger('click');
+ expect(submitFormSpy()).toHaveBeenCalled();
});
});