diff options
Diffstat (limited to 'spec/javascripts/fly_out_nav_spec.js')
-rw-r--r-- | spec/javascripts/fly_out_nav_spec.js | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/spec/javascripts/fly_out_nav_spec.js b/spec/javascripts/fly_out_nav_spec.js index 0fdaa2d8663..61e6c9f1fdb 100644 --- a/spec/javascripts/fly_out_nav_spec.js +++ b/spec/javascripts/fly_out_nav_spec.js @@ -1,7 +1,5 @@ import { calculateTop, - setMouseOutTimeout, - getHideTimeoutInterval, hideSubLevelItems, showSubLevelItems, } from '~/fly_out_nav'; @@ -41,26 +39,6 @@ describe('Fly out sidebar navigation', () => { }); }); - describe('setMouseOutTimeout', () => { - it('sets hideTimeoutInterval to 150 when inside sub items', () => { - el.innerHTML = '<div class="sidebar-sub-level-items"><div class="js-test"></div></div>'; - - setMouseOutTimeout(el.querySelector('.js-test')); - - expect( - getHideTimeoutInterval(), - ).toBe(150); - }); - - it('resets hideTimeoutInterval when not inside sub items', () => { - setMouseOutTimeout(el); - - expect( - getHideTimeoutInterval(), - ).toBe(0); - }); - }); - describe('hideSubLevelItems', () => { beforeEach(() => { el.innerHTML = '<div class="sidebar-sub-level-items"></div>'; @@ -142,16 +120,17 @@ describe('Fly out sidebar navigation', () => { it('sets is-above when element is above', () => { const subItems = el.querySelector('.sidebar-sub-level-items'); - subItems.style.height = '5000px'; + subItems.style.height = `${window.innerHeight + el.offsetHeight}px`; + subItems.style.position = 'absolute'; el.style.position = 'relative'; - el.style.top = '1000px'; + el.style.top = `${window.innerHeight - el.offsetHeight}px`; - spyOn(el.classList, 'add'); + spyOn(subItems.classList, 'add'); showSubLevelItems(el); expect( - el.classList.add, + subItems.classList.add, ).toHaveBeenCalledWith('is-above'); }); }); |