Skip to content

Commit c3beea7

Browse files
committed
fixup: use global navigator, not window for test replace
1 parent 23674eb commit c3beea7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/compass-components/src/hooks/use-hotkeys.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { expect } from 'chai';
44
import { useHotkeys, formatHotkey } from './use-hotkeys';
55
import sinon from 'sinon';
66

7-
const initialUserAgent = window.navigator.userAgent;
7+
const initialUserAgent = navigator.userAgent;
88

99
const mappingUseCases = {
1010
mac: [
@@ -39,15 +39,15 @@ const mappingUseCases = {
3939

4040
describe('use-hotkeys', function () {
4141
after(function () {
42-
Object.defineProperty(window.navigator, 'userAgent', {
42+
Object.defineProperty(navigator, 'userAgent', {
4343
value: initialUserAgent,
4444
writable: true,
4545
});
4646
});
4747

4848
context('on macOS', function () {
4949
before(function () {
50-
Object.defineProperty(window.navigator, 'userAgent', {
50+
Object.defineProperty(navigator, 'userAgent', {
5151
value:
5252
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36',
5353
writable: true,

0 commit comments

Comments
 (0)