diff --git a/spec/unit/footer/footer.spec.js b/spec/unit/footer/footer.spec.js index 03d77db2f4..d7828266e2 100755 --- a/spec/unit/footer/footer.spec.js +++ b/spec/unit/footer/footer.spec.js @@ -88,7 +88,8 @@ describe('big footer accordion', () => { }); it('closes panel on subsequent click', () => { - return resizeTo(400) + return resizeTo(800) + .then(() => resizeTo(400)) .then(() => { buttons[0].click(); assertHidden(lists[ 0 ], false); @@ -98,7 +99,8 @@ describe('big footer accordion', () => { }); it('closes other panels on small screens', () => { - return resizeTo(400) + return resizeTo(800) + .then(() => resizeTo(400)) .then(() => { buttons[0].click(); assertHidden(lists[ 0 ], false); diff --git a/src/js/components/footer.js b/src/js/components/footer.js index e55359ef6b..074fef528c 100755 --- a/src/js/components/footer.js +++ b/src/js/components/footer.js @@ -30,7 +30,11 @@ function showPanel() { } } +let lastInnerWidth; + const resize = debounce(() => { + if (lastInnerWidth === window.innerWidth) return; + lastInnerWidth = window.innerWidth; const hidden = window.innerWidth < HIDE_MAX_WIDTH; select(COLLAPSIBLE).forEach(list => list.classList.toggle(HIDDEN, hidden)); }, DEBOUNCE_RATE);