Skip to content

Commit

Permalink
Unit tests for enable/disable scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmrj committed Jan 14, 2025
1 parent c5bcee8 commit a28c1e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/blocks/global-navigation/global-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,5 +767,22 @@ describe('global navigation', () => {
headline.click();
expect(headline.getAttribute('aria-expanded')).to.equal('true');
});
it('disables scroll for the popup but not for the localnav', async () => {
Object.defineProperty(navigator, 'userAgent', { get: () => 'Safari' });
await createFullGlobalNavigation({ globalNavigation: gnavWithlocalNav, viewport: 'mobile' });
const localNavTitle = document.querySelector(selectors.localNavTitle);
localNavTitle.click();
const localNav = document.querySelector(selectors.localNav);
const curtain = localNav.querySelector('.feds-localnav-curtain');
expect(document.body.classList.contains('disable-ios-scroll')).to.equal(false);
curtain.click();
expect(document.body.classList.contains('disable-ios-scroll')).to.equal(false);
const toggle = document.querySelector(selectors.mainNavToggle);
toggle.click();
expect(document.body.classList.contains('disable-ios-scroll')).to.equal(true);
const close = document.querySelector('.close-icon');
close.click();
expect(document.body.classList.contains('disable-ios-scroll')).to.equal(false);
});
});
});

0 comments on commit a28c1e4

Please sign in to comment.