diff options
author | Phil Hughes <me@iamphill.com> | 2017-09-18 15:42:41 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-09-22 17:13:46 +0100 |
commit | c4b2d1878a9ce54f9f68aea5f18703c7ed3b385b (patch) | |
tree | 91a7792b4479767703134bd3d9b357056e9abdd6 | |
parent | 17251d0464e2c5a61c56f45b435fcf5356d4273b (diff) | |
download | gitlab-ce-c4b2d1878a9ce54f9f68aea5f18703c7ed3b385b.tar.gz |
Fixed fly-out error if mousePos array is empty
-rw-r--r-- | app/assets/javascripts/fly_out_nav.js | 2 | ||||
-rw-r--r-- | spec/javascripts/fly_out_nav_spec.js | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js index 157280d66e3..a848135f8e6 100644 --- a/app/assets/javascripts/fly_out_nav.js +++ b/app/assets/javascripts/fly_out_nav.js @@ -34,7 +34,7 @@ export const canShowActiveSubItems = (el) => { export const canShowSubItems = () => bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md' || bp.getBreakpointSize() === 'lg'; export const getHideSubItemsInterval = () => { - if (!currentOpenMenu) return 0; + if (!currentOpenMenu || mousePos.length >= 1) return 0; const currentMousePos = mousePos[mousePos.length - 1]; const prevMousePos = mousePos[0]; diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js index f4b4d7980a4..4f20e31f511 100644 --- a/spec/javascripts/fly_out_nav_spec.js +++ b/spec/javascripts/fly_out_nav_spec.js @@ -73,6 +73,12 @@ describe('Fly out sidebar navigation', () => { ).toBe(0); }); + it('returns 0 if mousePos is empty', () => { + expect( + getHideSubItemsInterval(), + ).toBe(0); + }); + it('returns 0 when mouse above sub-items', () => { showSubLevelItems(el); documentMouseMove({ |