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>2022-04-20 13:00:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 13:00:54 +0300
commit3cccd102ba543e02725d247893729e5c73b38295 (patch)
treef36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/issuable/issuable_form_spec.js
parent205943281328046ef7b4528031b90fbda70c75ac (diff)
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/issuable/issuable_form_spec.js')
-rw-r--r--spec/frontend/issuable/issuable_form_spec.js44
1 files changed, 35 insertions, 9 deletions
diff --git a/spec/frontend/issuable/issuable_form_spec.js b/spec/frontend/issuable/issuable_form_spec.js
index 321c61ead1e..99ed18cf5bd 100644
--- a/spec/frontend/issuable/issuable_form_spec.js
+++ b/spec/frontend/issuable/issuable_form_spec.js
@@ -1,20 +1,46 @@
import $ from 'jquery';
import IssuableForm from '~/issuable/issuable_form';
-
-function createIssuable() {
- const instance = new IssuableForm($(document.createElement('form')));
-
- instance.titleField = $(document.createElement('input'));
-
- return instance;
-}
+import setWindowLocation from 'helpers/set_window_location_helper';
describe('IssuableForm', () => {
let instance;
+ const createIssuable = (form) => {
+ instance = new IssuableForm(form);
+ };
+
beforeEach(() => {
- instance = createIssuable();
+ setFixtures(`
+ <form>
+ <input name="[title]" />
+ </form>
+ `);
+ createIssuable($('form'));
+ });
+
+ describe('initAutosave', () => {
+ it('creates autosave with the searchTerm included', () => {
+ setWindowLocation('https://gitlab.test/foo?bar=true');
+ const autosave = instance.initAutosave();
+
+ expect(autosave.key.includes('bar=true')).toBe(true);
+ });
+
+ it("creates autosave fields without the searchTerm if it's an issue new form", () => {
+ setFixtures(`
+ <form data-new-issue-path="/issues/new">
+ <input name="[title]" />
+ </form>
+ `);
+ createIssuable($('form'));
+
+ setWindowLocation('https://gitlab.test/issues/new?bar=true');
+
+ const autosave = instance.initAutosave();
+
+ expect(autosave.key.includes('bar=true')).toBe(false);
+ });
});
describe('removeWip', () => {