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:
authorPhil Hughes <me@iamphill.com>2017-08-19 22:41:23 +0300
committerPhil Hughes <me@iamphill.com>2017-08-19 22:41:23 +0300
commit9a93fd9ec4e765873d49c3d8e29ca165b43ba083 (patch)
tree41ea36ad756202117658172f6b088329aaad58e9 /spec/javascripts/fly_out_nav_spec.js
parent84336b848caec71b9c2af2d826cf81e6a258f6e2 (diff)
Fixed fly-out nav jumping
Closes #36699
Diffstat (limited to 'spec/javascripts/fly_out_nav_spec.js')
-rw-r--r--spec/javascripts/fly_out_nav_spec.js34
1 files changed, 10 insertions, 24 deletions
diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js
index 2e81a1b056b..0847e463577 100644
--- a/spec/javascripts/fly_out_nav_spec.js
+++ b/spec/javascripts/fly_out_nav_spec.js
@@ -1,4 +1,3 @@
-import Cookies from 'js-cookie';
import {
calculateTop,
showSubLevelItems,
@@ -11,6 +10,7 @@ import {
getHideSubItemsInterval,
documentMouseMove,
getHeaderHeight,
+ setSidebar,
} from '~/fly_out_nav';
import bp from '~/breakpoints';
@@ -113,7 +113,6 @@ describe('Fly out sidebar navigation', () => {
clientX: el.getBoundingClientRect().left + 20,
clientY: el.getBoundingClientRect().top + 10,
});
- console.log(el);
expect(
getHideSubItemsInterval(),
@@ -283,7 +282,7 @@ describe('Fly out sidebar navigation', () => {
describe('canShowActiveSubItems', () => {
afterEach(() => {
- Cookies.remove('sidebar_collapsed');
+ setSidebar(null);
});
it('returns true by default', () => {
@@ -292,36 +291,23 @@ describe('Fly out sidebar navigation', () => {
).toBeTruthy();
});
- it('returns false when cookie is false & element is active', () => {
- Cookies.set('sidebar_collapsed', 'false');
+ it('returns false when active & expanded sidebar', () => {
+ const sidebar = document.createElement('div');
el.classList.add('active');
- expect(
- canShowActiveSubItems(el),
- ).toBeFalsy();
- });
-
- it('returns true when cookie is false & element is active', () => {
- Cookies.set('sidebar_collapsed', 'true');
- el.classList.add('active');
+ setSidebar(sidebar);
expect(
canShowActiveSubItems(el),
- ).toBeTruthy();
+ ).toBeFalsy();
});
- it('returns true when element is active & breakpoint is sm', () => {
- breakpointSize = 'sm';
+ it('returns true when active & collapsed sidebar', () => {
+ const sidebar = document.createElement('div');
+ sidebar.classList.add('sidebar-icons-only');
el.classList.add('active');
- expect(
- canShowActiveSubItems(el),
- ).toBeTruthy();
- });
-
- it('returns true when element is active & breakpoint is md', () => {
- breakpointSize = 'md';
- el.classList.add('active');
+ setSidebar(sidebar);
expect(
canShowActiveSubItems(el),