190 display ctrl instead of for windows users (#9617)
Closes https://github.com/twentyhq/core-team-issues/issues/190 <img width="226" alt="Capture d’écran 2025-01-15 à 12 07 12" src="https://github.com/user-attachments/assets/b9a13746-2629-477a-9795-cda03c63f8f6" /> To test, update the user agent in your browser dev tools: <img width="459" alt="Capture d’écran 2025-01-15 à 12 14 29" src="https://github.com/user-attachments/assets/4371d5fc-fd3c-403d-beaa-7ba58019d3c9" />
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
import { getOsControlSymbol } from '../getOsControlSymbol';
|
||||
|
||||
describe('getOsControlSymbol', () => {
|
||||
let userAgentSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
userAgentSpy = jest.spyOn(window.navigator, 'userAgent', 'get');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
userAgentSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should return Ctrl for Windows', () => {
|
||||
userAgentSpy.mockReturnValue(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
||||
);
|
||||
expect(getOsControlSymbol()).toBe('Ctrl');
|
||||
});
|
||||
|
||||
it('should return ⌘ for Mac', () => {
|
||||
userAgentSpy.mockReturnValue(
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
||||
);
|
||||
expect(getOsControlSymbol()).toBe('⌘');
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,27 @@
|
||||
import { getOsShortcutSeparator } from '../getOsShortcutSeparator';
|
||||
|
||||
describe('getOsShortcutSeparator', () => {
|
||||
let userAgentSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
userAgentSpy = jest.spyOn(window.navigator, 'userAgent', 'get');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
userAgentSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should return space for Windows', () => {
|
||||
userAgentSpy.mockReturnValue(
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',
|
||||
);
|
||||
expect(getOsShortcutSeparator()).toBe(' ');
|
||||
});
|
||||
|
||||
it('should return empty string for Mac', () => {
|
||||
userAgentSpy.mockReturnValue(
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
||||
);
|
||||
expect(getOsShortcutSeparator()).toBe('');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user