Commit 1bb01ab8 authored by Jeff Avallone's avatar Jeff Avallone

Allowing Privacy Policy link click to happen with modifier key

parent 2c8b7797
Pipeline #43942123 passed with stages
in 3 minutes and 57 seconds
......@@ -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 });
}
......
......@@ -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(
<Header banner={ false } />
);
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(
<Header banner={ false } />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment