summaryrefslogtreecommitdiff
path: root/spec/javascripts/fly_out_nav_spec.js
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-08-31 09:17:23 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-08-31 09:17:23 +0100
commitf884a4bbd7ccaf448e0d998711d20497cef6ac71 (patch)
tree65c9b70b58dea175d188114ce066cd17baf12888 /spec/javascripts/fly_out_nav_spec.js
parent32a68328d719327d26e82684cdf354ed25598416 (diff)
parent3e092caa91853afeab3bb01be10869e45c39de5d (diff)
downloadgitlab-ce-repo-bugs.tar.gz
Merge remote-tracking branch 'origin/master' into repo-bugsrepo-bugs
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),