Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-18 00:09:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-18 00:09:23 +0300
commit1d84a028b42a1a3aed36a0f3a6cae970c8df8e69 (patch)
tree1ebd0249d20169a0b8be47dc541e9c2676d62648 /spec/frontend/issuable_form_spec.js
parentec72da1833d94bb1556af94193ccf2a93c9cb939 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/issuable_form_spec.js')
-rw-r--r--spec/frontend/issuable_form_spec.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/frontend/issuable_form_spec.js b/spec/frontend/issuable_form_spec.js
new file mode 100644
index 00000000000..009ca28ff78
--- /dev/null
+++ b/spec/frontend/issuable_form_spec.js
@@ -0,0 +1,56 @@
+import $ from 'jquery';
+
+import IssuableForm from '~/issuable_form';
+
+function createIssuable() {
+ const instance = new IssuableForm($(document.createElement('form')));
+
+ instance.titleField = $(document.createElement('input'));
+
+ return instance;
+}
+
+describe('IssuableForm', () => {
+ let instance;
+
+ beforeEach(() => {
+ instance = createIssuable();
+ });
+
+ describe('removeWip', () => {
+ it.each`
+ prefix
+ ${'wip '}
+ ${' wIP: '}
+ ${'[WIp] '}
+ ${'wIP:'}
+ ${' [WIp]'}
+ ${'drAft '}
+ ${'draFT: '}
+ ${' [DRaft] '}
+ ${'drAft:'}
+ ${'[draFT]'}
+ ${' dRaFt - '}
+ ${'dRaFt - '}
+ ${'(draft) '}
+ ${' (DrafT)'}
+ ${'wip wip: [wip] draft draft - draft: [draft] (draft)'}
+ `('removes "$prefix" from the beginning of the title', ({ prefix }) => {
+ instance.titleField.val(`${prefix}The Issuable's Title Value`);
+
+ instance.removeWip();
+
+ expect(instance.titleField.val()).toBe("The Issuable's Title Value");
+ });
+ });
+
+ describe('addWip', () => {
+ it("properly adds the work in progress prefix to the Issuable's title", () => {
+ instance.titleField.val("The Issuable's Title Value");
+
+ instance.addWip();
+
+ expect(instance.titleField.val()).toBe("Draft: The Issuable's Title Value");
+ });
+ });
+});