debian-mirror-gitlab/spec/frontend/constants_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
774 B
JavaScript
Raw Normal View History

2023-03-17 16:20:25 +05:30
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);
},
);
});
});