Commit a3d9b064 authored by Eric Eastwood's avatar Eric Eastwood

Don't disable submit buttonw when there is text in the input

See https://gitlab.com/gitlab-org/gitlab-ce/issues/34336
parent c073bb77
......@@ -47,7 +47,8 @@ export default {
computed: {
isSubmitButtonDisabled() {
return this.pendingReferences.length === 0 || this.isSubmitting;
return (this.inputValue.length === 0 && this.pendingReferences.length === 0)
|| this.isSubmitting;
},
},
......
......@@ -40,19 +40,37 @@ describe('AddIssuableForm', () => {
describe('with data', () => {
describe('without references', () => {
beforeEach(() => {
vm = new AddIssuableForm({
propsData: {
inputValue: '',
addButtonLabel: 'Submit',
pendingReferences: [],
},
}).$mount();
describe('without any input text', () => {
beforeEach(() => {
vm = new AddIssuableForm({
propsData: {
inputValue: '',
addButtonLabel: 'Submit',
pendingReferences: [],
},
}).$mount();
});
it('should have disabled submit button', () => {
expect(vm.$refs.addButton.disabled).toBe(true);
expect(vm.$refs.loadingIcon).toBeUndefined();
});
});
it('should have disabled submit button', () => {
expect(vm.$refs.addButton.disabled).toBe(true);
expect(vm.$refs.loadingIcon).toBeUndefined();
describe('with input text', () => {
beforeEach(() => {
vm = new AddIssuableForm({
propsData: {
inputValue: 'foo',
addButtonLabel: 'Submit',
pendingReferences: [],
},
}).$mount();
});
it('should not have disabled submit button', () => {
expect(vm.$refs.addButton.disabled).toBe(false);
});
});
});
......@@ -84,6 +102,10 @@ describe('AddIssuableForm', () => {
it('should render pending issuables items', () => {
expect(vm.$el.querySelectorAll('.js-add-issuable-form-token-list-item').length).toEqual(2);
});
it('should not have disabled submit button', () => {
expect(vm.$refs.addButton.disabled).toBe(false);
});
});
describe('when submitting', () => {
......
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