Android: Fixes #10152: Fix broken plugin API: editor.execCommand (#10153)

This commit is contained in:
Henry Heino authored and GitHub committed 2024-03-20 10:58:42 +00:00
1 parent 32141d4e23
commit 44e8950f1b
8 files changed
+78 -20

No files matched your search

+19
View File
@@ -14,3 +14,22 @@ module.exports = () => {
global.console = jestConsole;
});
};
// jsdom extensions
if (typeof document !== 'undefined') {
// Prevents the CodeMirror error "getClientRects is undefined".
// See https://github.com/jsdom/jsdom/issues/3002#issue-652790925
document.createRange = () => {
const range = new Range();
range.getBoundingClientRect = jest.fn();
range.getClientRects = () => {
return {
length: 0,
item: () => null,
[Symbol.iterator]: jest.fn(),
};
};
return range;
};
}