Skip to content

Commit 17d5982

Browse files
committed
Provide simple mock for resize observer
1 parent e9aed7f commit 17d5982

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

specifyweb/frontend/js_src/lib/localization/common.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,6 @@ export const commonText = createDictionary({
231231
'fr-fr': 'Mettre à jour',
232232
'uk-ua': 'Оновити',
233233
},
234-
listTruncated: {
235-
'en-us': '(list truncated)',
236-
'ru-ru': '(список усечен)',
237-
'es-es': '(lista truncada)',
238-
'fr-fr': '(liste tronquée)',
239-
'uk-ua': '(список скорочено)',
240-
},
241234
fullDate: {
242235
'en-us': 'Full Date',
243236
'ru-ru': 'Полная дата',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Object.defineProperty(globalThis, 'ResizeObserver', {
2+
/**
3+
* Can't use an arrow function or method shorthand here because Response
4+
* should be invokable with "new" (as in "new ResizeObserver()")
5+
*/
6+
// eslint-disable-next-line object-shorthand
7+
value: function () {
8+
return {
9+
observe: (): void => {},
10+
disconnect: (): void => {},
11+
};
12+
},
13+
});
14+
15+
export {};

specifyweb/frontend/js_src/lib/tests/setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '@testing-library/jest-dom';
66
import './__mocks__/CSS';
77
import './__mocks__/Response';
88
import './__mocks__/matchMedia';
9+
import './__mocks__/ResizeObserver';
910

1011
import { configure } from '@testing-library/react';
1112
import failOnConsole from 'jest-fail-on-console';

0 commit comments

Comments
 (0)