diff --git a/src/components/Header/index.js b/src/components/Header/index.js index f6d2a4a..3dadb70 100644 --- a/src/components/Header/index.js +++ b/src/components/Header/index.js @@ -26,6 +26,10 @@ class Header extends React.PureComponent { } handleOpen = event => { + if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) { + return; + } + event.preventDefault(); this.setState({ showModal: true }); } diff --git a/src/components/Header/test.js b/src/components/Header/test.js index 75cac6a..b371e36 100644 --- a/src/components/Header/test.js +++ b/src/components/Header/test.js @@ -30,6 +30,20 @@ describe('Header', () => { expect(component).toMatchSnapshot(); }); + ['shift', 'ctrl', 'alt', 'meta'].forEach(key => { + test(`opening the Privacy Policy modal while holding ${ key } key`, () => { + const component = shallow( +
+ ); + const eventObj = { preventDefault: jest.fn() }; + + component.instance().handleOpen({ [key + 'Key']: true, ...eventObj }); + + expect(eventObj.preventDefault).not.toHaveBeenCalled(); + expect(component.state('showModal')).toEqual(false); + }); + }); + test('closing the Privacy Policy modal', () => { const component = shallow(