Commit a3389934 authored by Thomas Chandelle's avatar Thomas Chandelle Committed by Paul Slaughter

Set type of Web IDE commit button to submit

Also remove redundant click listener, already handle
by form submit listener

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79259

Changelog: other
parent d967565a
...@@ -187,7 +187,7 @@ export default { ...@@ -187,7 +187,7 @@ export default {
class="qa-commit-button" class="qa-commit-button"
category="primary" category="primary"
variant="confirm" variant="confirm"
@click="commit" type="submit"
> >
{{ __('Commit') }} {{ __('Commit') }}
</gl-button> </gl-button>
......
...@@ -56,7 +56,6 @@ describe('IDE commit form', () => { ...@@ -56,7 +56,6 @@ describe('IDE commit form', () => {
disabled: findCommitButton().props('disabled'), disabled: findCommitButton().props('disabled'),
tooltip: getBinding(findCommitButtonTooltip().element, 'gl-tooltip').value.title, tooltip: getBinding(findCommitButtonTooltip().element, 'gl-tooltip').value.title,
}); });
const clickCommitButton = () => findCommitButton().vm.$emit('click');
const findForm = () => wrapper.find('form'); const findForm = () => wrapper.find('form');
const submitForm = () => findForm().trigger('submit'); const submitForm = () => findForm().trigger('submit');
const findCommitMessageInput = () => wrapper.find(CommitMessageField); const findCommitMessageInput = () => wrapper.find(CommitMessageField);
...@@ -283,8 +282,8 @@ describe('IDE commit form', () => { ...@@ -283,8 +282,8 @@ describe('IDE commit form', () => {
jest.spyOn(store, 'dispatch').mockResolvedValue(); jest.spyOn(store, 'dispatch').mockResolvedValue();
}); });
it.each([clickCommitButton, submitForm])('when %p, commits changes', (fn) => { it('when submitting form, commits changes', () => {
fn(); submitForm();
expect(store.dispatch).toHaveBeenCalledWith('commit/commitChanges', undefined); expect(store.dispatch).toHaveBeenCalledWith('commit/commitChanges', undefined);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment