Skip to content

Commit

Permalink
Update footer.spec.js for real this time
Browse files Browse the repository at this point in the history
Force a resize that has a new innerWidth
  • Loading branch information
joncasey committed Apr 26, 2019
1 parent f051c8e commit 2a46ab0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spec/unit/footer/footer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const BUTTON_SELECTOR = '.usa-footer__primary-link';
* @return {Promise}
*/
const resizeTo = width => new Promise((resolve) => {
window.innerWidth = width;
window.dispatchEvent(new CustomEvent('resize'));
if (width !== window.innerWidth) {
window.innerWidth = width;
window.dispatchEvent(new CustomEvent('resize'));
}
setTimeout(resolve, DEBOUNCE_RATE + 10);
});

Expand Down Expand Up @@ -86,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);
Expand All @@ -96,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);
Expand Down

0 comments on commit 2a46ab0

Please sign in to comment.