summaryrefslogtreecommitdiff
path: root/spec/javascripts/issue_show/components/app_spec.js
diff options
context:
space:
mode:
authorFilipe Freire <livrofubia@gmail.com>2018-01-25 20:23:19 +0000
committerFilipe Freire <livrofubia@gmail.com>2018-01-25 20:23:19 +0000
commit03b87ec943ec9e48106a8d94350f6d5011e30519 (patch)
tree77bc2b00229c4d5598cb94db379f6beae240f792 /spec/javascripts/issue_show/components/app_spec.js
parent350dbca41c2be6717d4c9f5800ef6dd60b06d932 (diff)
parent10d8026f69efe83a0f4759f91c5087effd676191 (diff)
downloadgitlab-ce-03b87ec943ec9e48106a8d94350f6d5011e30519.tar.gz
Merge branch 'master' of https://gitlab.com/filipefreire/gitlab-ce into filipefreire_155
Diffstat (limited to 'spec/javascripts/issue_show/components/app_spec.js')
-rw-r--r--spec/javascripts/issue_show/components/app_spec.js35
1 files changed, 34 insertions, 1 deletions
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js
index 1454ca52018..1c9f48028f2 100644
--- a/spec/javascripts/issue_show/components/app_spec.js
+++ b/spec/javascripts/issue_show/components/app_spec.js
@@ -59,7 +59,7 @@ describe('Issuable output', () => {
});
afterEach(() => {
- mock.reset();
+ mock.restore();
realtimeRequestCount = 0;
vm.poll.stop();
@@ -218,6 +218,39 @@ describe('Issuable output', () => {
});
});
+ describe('shows dialog when issue has unsaved changed', () => {
+ it('confirms on title change', (done) => {
+ vm.showForm = true;
+ vm.state.titleText = 'title has changed';
+ const e = { returnValue: null };
+ vm.handleBeforeUnloadEvent(e);
+ Vue.nextTick(() => {
+ expect(e.returnValue).not.toBeNull();
+ done();
+ });
+ });
+
+ it('confirms on description change', (done) => {
+ vm.showForm = true;
+ vm.state.descriptionText = 'description has changed';
+ const e = { returnValue: null };
+ vm.handleBeforeUnloadEvent(e);
+ Vue.nextTick(() => {
+ expect(e.returnValue).not.toBeNull();
+ done();
+ });
+ });
+
+ it('does nothing when nothing has changed', (done) => {
+ const e = { returnValue: null };
+ vm.handleBeforeUnloadEvent(e);
+ Vue.nextTick(() => {
+ expect(e.returnValue).toBeNull();
+ done();
+ });
+ });
+ });
+
describe('error when updating', () => {
beforeEach(() => {
spyOn(window, 'Flash').and.callThrough();