summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-05-22 14:14:04 +0100
committerPhil Hughes <me@iamphill.com>2017-05-22 14:14:04 +0100
commit21205d1e8537d965844c68af5b93ffa472144e9b (patch)
tree23701877abcb6609f7086ce5b3443e429267ddcd /spec/javascripts
parent745ec1acd1b0a60a35c78142f6cc99cf92a396c1 (diff)
parent3f996024cd2b7c30f8049e4b056a094100ece9f9 (diff)
downloadgitlab-ce-21205d1e8537d965844c68af5b93ffa472144e9b.tar.gz
Merge branch 'issue-edit-inline' into issue-edit-inline-description-template
[ci skip]
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/issue_show/components/app_spec.js32
-rw-r--r--spec/javascripts/issue_show/components/fields/description_template_spec.js2
-rw-r--r--spec/javascripts/issue_show/components/form_spec.js23
3 files changed, 57 insertions, 0 deletions
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js
index 91ae3cfd97c..3247f83d551 100644
--- a/spec/javascripts/issue_show/components/app_spec.js
+++ b/spec/javascripts/issue_show/components/app_spec.js
@@ -285,4 +285,36 @@ describe('Issuable output', () => {
});
});
});
+
+ describe('open form', () => {
+ it('shows locked warning if form is open & data is different', (done) => {
+ Vue.http.interceptors.push(issueShowInterceptor(issueShowData.initialRequest));
+
+ Vue.nextTick()
+ .then(() => new Promise((resolve) => {
+ setTimeout(resolve);
+ }))
+ .then(() => {
+ vm.openForm();
+
+ Vue.http.interceptors.push(issueShowInterceptor(issueShowData.secondRequest));
+
+ return new Promise((resolve) => {
+ setTimeout(resolve);
+ });
+ })
+ .then(() => {
+ expect(
+ vm.formState.lockedWarningVisible,
+ ).toBeTruthy();
+
+ expect(
+ vm.$el.querySelector('.alert'),
+ ).not.toBeNull();
+
+ done();
+ })
+ .catch(done.fail);
+ });
+ });
});
diff --git a/spec/javascripts/issue_show/components/fields/description_template_spec.js b/spec/javascripts/issue_show/components/fields/description_template_spec.js
index d6702e4a8f7..2b7ee65094b 100644
--- a/spec/javascripts/issue_show/components/fields/description_template_spec.js
+++ b/spec/javascripts/issue_show/components/fields/description_template_spec.js
@@ -17,6 +17,8 @@ describe('Issue description template component', () => {
propsData: {
formState,
issuableTemplates: [{ name: 'test' }],
+ projectPath: '/',
+ projectNamespace: '/',
},
}).$mount();
diff --git a/spec/javascripts/issue_show/components/form_spec.js b/spec/javascripts/issue_show/components/form_spec.js
index a2bf1de0576..9a85223208c 100644
--- a/spec/javascripts/issue_show/components/form_spec.js
+++ b/spec/javascripts/issue_show/components/form_spec.js
@@ -12,12 +12,17 @@ describe('Inline edit form component', () => {
vm = new Component({
propsData: {
canDestroy: true,
+ canMove: true,
formState: {
title: 'b',
description: 'a',
+ lockedWarningVisible: false,
},
markdownPreviewUrl: '/',
markdownDocs: '/',
+ projectsAutocompleteUrl: '/',
+ projectPath: '/',
+ projectNamespace: '/',
},
}).$mount();
@@ -42,4 +47,22 @@ describe('Inline edit form component', () => {
done();
});
});
+
+ it('hides locked warning by default', () => {
+ expect(
+ vm.$el.querySelector('.alert'),
+ ).toBeNull();
+ });
+
+ it('shows locked warning if formState is different', (done) => {
+ vm.formState.lockedWarningVisible = true;
+
+ Vue.nextTick(() => {
+ expect(
+ vm.$el.querySelector('.alert'),
+ ).not.toBeNull();
+
+ done();
+ });
+ });
});