diff --git a/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue b/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue index 145c38f58689db6306097ad36b10eabe8373ec1c..1933c797cb846a64f5cdee464a5c521b7d0f8a15 100644 --- a/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue +++ b/app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue @@ -147,9 +147,6 @@ export default { autocompleteDataSources() { return gl.GfmAutoComplete?.dataSources; }, - noContent() { - return !this.content.trim(); - }, csrfToken() { return csrf.token; }, @@ -200,7 +197,7 @@ export default { return !this.isContentEditorActive; }, disableSubmitButton() { - return this.noContent || !this.title; + return !this.title; }, drawioEnabled() { return typeof this.drawioUrl === 'string' && this.drawioUrl.length > 0; diff --git a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js index 304e73ce460804bc7d6ffadc472106c2886e7796..554499607118efe158cc69487a2fb5f7a2863e3e 100644 --- a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js +++ b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js @@ -365,9 +365,8 @@ describe('WikiForm', () => { title | content | buttonState | disabledAttr ${'something'} | ${'something'} | ${'enabled'} | ${false} ${''} | ${'something'} | ${'disabled'} | ${true} - ${'something'} | ${''} | ${'disabled'} | ${true} + ${'something'} | ${''} | ${'disabled'} | ${false} ${''} | ${''} | ${'disabled'} | ${true} - ${' '} | ${' '} | ${'disabled'} | ${true} `( "when title='$title', content='$content', then the button is $buttonState'", async ({ title, content, disabledAttr }) => { diff --git a/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb index 38fb9a0b62e9b6f907396c7416e4405362375dda..9324be031f1631bfd713dd0ff4a83e24b671321e 100644 --- a/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb @@ -24,9 +24,16 @@ end end - it "disables the submit button", :js do + it "does not disable the submit button", :js do page.within(".wiki-form") do fill_in(:wiki_content, with: "") + expect(page).to have_button('Create page', disabled: false) + end + end + + it "disables the submit button", :js do + page.within(".wiki-form") do + fill_in(:wiki_title, with: "") expect(page).to have_button('Create page', disabled: true) end end diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb index c8d5d548db8ab8f3b514bed3cd98f69a6d36fe9f..7fff7e836dadc52955308fa571e31d604472ff30 100644 --- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb @@ -144,9 +144,16 @@ expect(page).to have_field('wiki[message]', with: 'Update Wiki title') end - it "disables the submit button", :js do + it "does not disable the submit button", :js do page.within(".wiki-form") do fill_in(:wiki_content, with: "") + expect(page).to have_button('Save changes', disabled: false) + end + end + + it "disables the submit button", :js do + page.within(".wiki-form") do + fill_in(:wiki_title, with: "") expect(page).to have_button('Save changes', disabled: true) end end diff --git a/spec/support/shared_examples/features/wiki/user_views_wiki_empty_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_views_wiki_empty_shared_examples.rb index b6c0a43dcf61024bed1de4a11284dad26ac9699a..f3fb1b9229dd8a1e017964f6cb2c085fa3c0774e 100644 --- a/spec/support/shared_examples/features/wiki/user_views_wiki_empty_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_views_wiki_empty_shared_examples.rb @@ -53,7 +53,7 @@ if writable element.click_link 'Create your first page' - expect(page).to have_button('Create page', disabled: true) + expect(page).to have_button('Create page') else expect(element).not_to have_link('Create your first page') end