Commit 0ba36a02 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '343189-fix-toggle-draft' into 'master'

Fix MR draft RegEx

See merge request gitlab-org/gitlab!72454
parents c056010c 04cee581
...@@ -53,7 +53,7 @@ export default class IssuableForm { ...@@ -53,7 +53,7 @@ export default class IssuableForm {
// prettier-ignore // prettier-ignore
this.draftRegex = new RegExp( this.draftRegex = new RegExp(
'^\\s*(' + // Line start, then any amount of leading whitespace '^\\s*(' + // Line start, then any amount of leading whitespace
'|\\[draft\\]\\s*' + // [Draft] and any following whitespace '\\[draft\\]\\s*' + // [Draft] and any following whitespace
'|draft:\\s*' + // Draft: and any following whitespace '|draft:\\s*' + // Draft: and any following whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace '|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical ')+' + // At least one repeated match of the preceding parenthetical
......
...@@ -45,4 +45,18 @@ describe('IssuableForm', () => { ...@@ -45,4 +45,18 @@ describe('IssuableForm', () => {
expect(instance.titleField.val()).toBe("Draft: The Issuable's Title Value"); expect(instance.titleField.val()).toBe("Draft: The Issuable's Title Value");
}); });
}); });
describe('workInProgress', () => {
it.each`
title | expected
${'draFT: something is happening'} | ${true}
${'draft something is happening'} | ${false}
${'something is happening to drafts'} | ${false}
${'something is happening'} | ${false}
`('returns $expected with "$title"', ({ title, expected }) => {
instance.titleField.val(title);
expect(instance.workInProgress()).toBe(expected);
});
});
}); });
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