Commit c19c1ad6 authored by Paul Slaughter's avatar Paul Slaughter

Fix create snippet disabled on empty file path

It turns out the BE supports this and it works with
multi-file snippets too.
parent e4cba057
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
return this.actions.length > 0; return this.actions.length > 0;
}, },
hasValidBlobs() { hasValidBlobs() {
return this.actions.every(x => x.filePath && x.content); return this.actions.every(x => x.content);
}, },
updatePrevented() { updatePrevented() {
return this.snippet.title === '' || !this.hasValidBlobs || this.isUpdating; return this.snippet.title === '' || !this.hasValidBlobs || this.isUpdating;
......
---
title: Fix snippet save button disabled with empty file path
merge_request: 40412
author:
type: fixed
...@@ -183,7 +183,7 @@ describe('Snippet Edit app', () => { ...@@ -183,7 +183,7 @@ describe('Snippet Edit app', () => {
${'foo'} | ${[]} | ${false} ${'foo'} | ${[]} | ${false}
${'foo'} | ${[TEST_ACTIONS.VALID]} | ${false} ${'foo'} | ${[TEST_ACTIONS.VALID]} | ${false}
${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_CONTENT]} | ${true} ${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_CONTENT]} | ${true}
${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_PATH]} | ${true} ${'foo'} | ${[TEST_ACTIONS.VALID, TEST_ACTIONS.NO_PATH]} | ${false}
`( `(
'should handle submit disable (title=$title, actions=$actions, shouldDisable=$shouldDisable)', 'should handle submit disable (title=$title, actions=$actions, shouldDisable=$shouldDisable)',
async ({ title, actions, shouldDisable }) => { async ({ title, actions, shouldDisable }) => {
......
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