summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2017-04-06 22:22:08 +0000
committerJacob Schatz <jschatz@gitlab.com>2017-04-06 22:22:08 +0000
commitd2aea4cde0574b1dfbfc3d8d85ab80195fc29e3f (patch)
tree836a793a744e84cd4f76a8205fa9abfe7ba64435 /spec/javascripts
parent5fbb9e95449fd521447aa802269962c5a972467f (diff)
parent3380ee716d00ce65441166f80c2f2c7313da9b9c (diff)
downloadgitlab-ce-d2aea4cde0574b1dfbfc3d8d85ab80195fc29e3f.tar.gz
Merge branch '29193-fix-switching-mr-changes-tab-before-loading' into 'master'
Fix container going full-width when switching from "Side-by-side" "Changes" MR tab before done loading Closes #29193 See merge request !10172
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/merge_request_tabs_spec.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js
index 7b9632be84e..65b2fd53397 100644
--- a/spec/javascripts/merge_request_tabs_spec.js
+++ b/spec/javascripts/merge_request_tabs_spec.js
@@ -3,6 +3,9 @@
require('~/merge_request_tabs');
require('~/breakpoints');
require('~/lib/utils/common_utils');
+require('~/diff');
+require('~/single_file_diff');
+require('~/files_comment_button');
require('vendor/jquery.scrollTo');
(function () {
@@ -213,6 +216,10 @@ require('vendor/jquery.scrollTo');
describe('with "Side-by-side"/parallel diff view', () => {
beforeEach(function () {
this.class.diffViewType = () => 'parallel';
+ gl.Diff.prototype.diffViewType = () => 'parallel';
+ spyOn($, 'ajax').and.callFake(function (options) {
+ options.success({ html: '' });
+ });
});
it('maintains `container-limited` for pipelines tab', function (done) {
@@ -224,7 +231,6 @@ require('vendor/jquery.scrollTo');
});
});
};
-
asyncClick('.merge-request-tabs .pipelines-tab a')
.then(() => asyncClick('.merge-request-tabs .diffs-tab a'))
.then(() => asyncClick('.merge-request-tabs .pipelines-tab a'))
@@ -237,6 +243,28 @@ require('vendor/jquery.scrollTo');
done.fail(`Something went wrong clicking MR tabs: ${err.message}\n${err.stack}`);
});
});
+
+ it('maintains `container-limited` when switching from "Changes" tab before it loads', function (done) {
+ const asyncClick = function (selector) {
+ return new Promise((resolve) => {
+ setTimeout(() => {
+ document.querySelector(selector).click();
+ resolve();
+ });
+ });
+ };
+
+ asyncClick('.merge-request-tabs .diffs-tab a')
+ .then(() => asyncClick('.merge-request-tabs .notes-tab a'))
+ .then(() => {
+ const hasContainerLimitedClass = document.querySelector('.content-wrapper .container-fluid').classList.contains('container-limited');
+ expect(hasContainerLimitedClass).toBe(true);
+ })
+ .then(done)
+ .catch((err) => {
+ done.fail(`Something went wrong clicking MR tabs: ${err.message}\n${err.stack}`);
+ });
+ });
});
});