Skip to content

Commit ccd486f

Browse files
committed
Lexical: Got a range of Editor tests working
1 parent 22d078b commit ccd486f

26 files changed

Lines changed: 116 additions & 486 deletions

jest.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ const config: Config = {
9393
// "node"
9494
// ],
9595

96-
modulePaths: ['/home/dan/web/bookstack/'],
96+
modulePaths: ['./'],
9797

9898
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
99-
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
99+
moduleNameMapper: {
100+
'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant',
101+
...pathsToModuleNameMapper(compilerOptions.paths),
102+
},
100103

101104
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
102105
// modulePathIgnorePatterns: [],

resources/js/wysiwyg/lexical/core/LexicalEditor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,13 @@ export class LexicalEditor {
12361236
}
12371237
}
12381238

1239+
/**
1240+
* Commits any currently pending updates scheduled for the editor.
1241+
*/
1242+
commitUpdates(): void {
1243+
$commitPendingUpdates(this);
1244+
}
1245+
12391246
/**
12401247
* Removes focus from the editor.
12411248
*/

resources/js/wysiwyg/lexical/core/__tests__/unit/CodeBlock.test.ts

Lines changed: 0 additions & 144 deletions
This file was deleted.

resources/js/wysiwyg/lexical/core/__tests__/unit/HTMLCopyAndPaste.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
DataTransferMock,
1818
initializeUnitTest,
1919
invariant,
20-
} from 'lexical/src/__tests__/utils';
20+
} from 'lexical/__tests__/utils';
2121

2222
describe('HTMLCopyAndPaste tests', () => {
2323
initializeUnitTest(

0 commit comments

Comments
 (0)