debian-mirror-gitlab/spec/frontend/constants_spec.js
2023-03-17 16:20:25 +05:30

31 lines
774 B
JavaScript

import * as constants from '~/constants';
describe('Global JS constants', () => {
describe('getModifierKey()', () => {
afterEach(() => {
delete window.gl;
});
it.each`
isMac | removeSuffix | expectedKey
${true} | ${false} | ${'⌘'}
${false} | ${false} | ${'Ctrl+'}
${true} | ${true} | ${'⌘'}
${false} | ${true} | ${'Ctrl'}
`(
'returns correct keystroke when isMac=$isMac and removeSuffix=$removeSuffix',
({ isMac, removeSuffix, expectedKey }) => {
Object.assign(window, {
gl: {
client: {
isMac,
},
},
});
expect(constants.getModifierKey(removeSuffix)).toBe(expectedKey);
},
);
});
});