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:
Diffstat (limited to 'spec/frontend/merge_request_tabs_spec.js')
-rw-r--r--spec/frontend/merge_request_tabs_spec.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/frontend/merge_request_tabs_spec.js b/spec/frontend/merge_request_tabs_spec.js
index f0f051cbc8b..2001bb5f95e 100644
--- a/spec/frontend/merge_request_tabs_spec.js
+++ b/spec/frontend/merge_request_tabs_spec.js
@@ -2,6 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
import $ from 'jquery';
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import initMrPage from 'helpers/init_vue_mr_page_helper';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import axios from '~/lib/utils/axios_utils';
import MergeRequestTabs from '~/merge_request_tabs';
import '~/lib/utils/common_utils';
@@ -24,6 +25,8 @@ describe('MergeRequestTabs', () => {
};
beforeEach(() => {
+ stubPerformanceWebAPI();
+
initMrPage();
testContext.class = new MergeRequestTabs({ stubLocation });
@@ -331,6 +334,8 @@ describe('MergeRequestTabs', () => {
${'diffs'} | ${true} | ${'hides'}
${'commits'} | ${true} | ${'hides'}
`('it $hidesText expand button on $tab tab', ({ tab, hides }) => {
+ window.gon = { features: { movedMrSidebar: true } };
+
const expandButton = document.createElement('div');
expandButton.classList.add('js-expand-sidebar');
@@ -344,16 +349,16 @@ describe('MergeRequestTabs', () => {
testContext.class = new MergeRequestTabs({ stubLocation });
testContext.class.tabShown(tab, 'foobar');
- expect(testContext.class.expandSidebar.classList.contains('gl-display-none!')).toBe(hides);
+ testContext.class.expandSidebar.forEach((el) => {
+ expect(el.classList.contains('gl-display-none!')).toBe(hides);
+ });
+
+ window.gon = {};
});
describe('when switching tabs', () => {
const SCROLL_TOP = 100;
- beforeAll(() => {
- jest.useFakeTimers();
- });
-
beforeEach(() => {
jest.spyOn(window, 'scrollTo').mockImplementation(() => {});
testContext.class.mergeRequestTabs = document.createElement('div');
@@ -362,10 +367,6 @@ describe('MergeRequestTabs', () => {
testContext.class.scrollPositions = { newTab: SCROLL_TOP };
});
- afterAll(() => {
- jest.useRealTimers();
- });
-
it('scrolls to the stored position, if one is stored', () => {
testContext.class.tabShown('newTab');