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 { ...@@ -47,7 +47,8 @@ export default {
computed: { computed: {
isSubmitButtonDisabled() { isSubmitButtonDisabled() {
return this.pendingReferences.length === 0 || this.isSubmitting; return (this.inputValue.length === 0 && this.pendingReferences.length === 0)
|| this.isSubmitting;
}, },
}, },
......
...@@ -40,6 +40,7 @@ describe('AddIssuableForm', () => { ...@@ -40,6 +40,7 @@ describe('AddIssuableForm', () => {
describe('with data', () => { describe('with data', () => {
describe('without references', () => { describe('without references', () => {
describe('without any input text', () => {
beforeEach(() => { beforeEach(() => {
vm = new AddIssuableForm({ vm = new AddIssuableForm({
propsData: { propsData: {
...@@ -56,6 +57,23 @@ describe('AddIssuableForm', () => { ...@@ -56,6 +57,23 @@ describe('AddIssuableForm', () => {
}); });
}); });
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);
});
});
});
describe('with references', () => { describe('with references', () => {
const inputValue = 'foo #123'; const inputValue = 'foo #123';
const addButtonLabel = 'Add issuable'; const addButtonLabel = 'Add issuable';
...@@ -84,6 +102,10 @@ describe('AddIssuableForm', () => { ...@@ -84,6 +102,10 @@ describe('AddIssuableForm', () => {
it('should render pending issuables items', () => { it('should render pending issuables items', () => {
expect(vm.$el.querySelectorAll('.js-add-issuable-form-token-list-item').length).toEqual(2); 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', () => { 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