diff --git a/jest.config.ts b/jest.config.ts
index 0243b39cd..11a86c672 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -93,10 +93,13 @@ const config: Config = {
// "node"
// ],
- modulePaths: ['/home/dan/web/bookstack/'],
+ modulePaths: ['./'],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
- moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
+ moduleNameMapper: {
+ 'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant',
+ ...pathsToModuleNameMapper(compilerOptions.paths),
+ },
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
diff --git a/resources/js/wysiwyg/lexical/core/LexicalEditor.ts b/resources/js/wysiwyg/lexical/core/LexicalEditor.ts
index b0b90002e..092429156 100644
--- a/resources/js/wysiwyg/lexical/core/LexicalEditor.ts
+++ b/resources/js/wysiwyg/lexical/core/LexicalEditor.ts
@@ -1236,6 +1236,13 @@ export class LexicalEditor {
}
}
+ /**
+ * Commits any currently pending updates scheduled for the editor.
+ */
+ commitUpdates(): void {
+ $commitPendingUpdates(this);
+ }
+
/**
* Removes focus from the editor.
*/
diff --git a/resources/js/wysiwyg/lexical/core/__tests__/unit/CodeBlock.test.ts b/resources/js/wysiwyg/lexical/core/__tests__/unit/CodeBlock.test.ts
deleted file mode 100644
index 5d6a9311b..000000000
--- a/resources/js/wysiwyg/lexical/core/__tests__/unit/CodeBlock.test.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
-
-import {$insertDataTransferForRichText} from '@lexical/clipboard';
-import {
- $createParagraphNode,
- $getRoot,
- $getSelection,
- $isRangeSelection,
-} from 'lexical';
-import {
- DataTransferMock,
- initializeUnitTest,
- invariant,
-} from 'lexical/__tests__/utils';
-
-describe('CodeBlock tests', () => {
- initializeUnitTest(
- (testEnv) => {
- beforeEach(async () => {
- const {editor} = testEnv;
- await editor.update(() => {
- const root = $getRoot();
- const paragraph = $createParagraphNode();
- root.append(paragraph);
- paragraph.select();
- });
- });
-
- /**
- * Code example for tests:
- *
- * function run() {
- * return [null, undefined, 2, ""];
- * }
- *
- */
- const EXPECTED_HTML = `function run() {
`;
-
- const CODE_PASTING_TESTS = [
- {
- expectedHTML: EXPECTED_HTML,
- name: 'VS Code',
- pastedHTML: `
return [null, undefined, 2, ""];
}
function run() {`, - }, - { - expectedHTML: EXPECTED_HTML, - name: 'WebStorm / Idea', - pastedHTML: `
return [null, undefined, 2, ""];
}
function run() {`, - }, - { - expectedHTML: `
return [null, undefined, 2, ""];
}
function run() {
return [null, undefined, 2, ""];
}
`,
- name: 'Postman IDE',
- pastedHTML: `function run() {\n return [null, undefined, 2, ""];\n}`, - }, - { - expectedHTML: `
const Lexical = requireCond('gk', 'runtime_is_dev', {
true: 'Lexical.dev',
false: 'Lexical.prod',
});
`,
- name: 'CodeHub',
- pastedHTML: `function run() { | |
return [null, undefined, 2, ""]; | |
} |
12
',
- pastedHTML: `12
`,
- },
- {
- expectedHTML: `1
2
`,
- name: 'Multiline ',
- // TODO This is not correct. This resembles how Lexical exports code right now but
- // semantically it should be wrapped in a pre
- pastedHTML: `1
2
`,
- },
- {
- expectedHTML: `Hello World Lexical
`,
- name: 'Multiple text formats',
- pastedHTML: `Hello World Lexical`,
- },
- {
- expectedHTML: `My document
`,
- name: 'Title from Google Docs',
- pastedHTML: `My document`,
- },
- {
- expectedHTML: `My document
`,
- name: 'Title from Google Docs Wrapped in Paragraph',
- pastedHTML: `My document
`,
- },
- {
- expectedHTML: `subscript and superscript
`,
- name: 'Subscript and Superscript',
- pastedHTML: `subscript and superscript`,
- },
- ];
-
- CODE_PASTING_TESTS.forEach((testCase, i) => {
- test(`Code block html paste: ${testCase.name}`, async () => {
- const {editor} = testEnv;
-
- const dataTransfer = new DataTransferMock();
- dataTransfer.setData('text/html', testCase.pastedHTML);
- await editor.update(() => {
- const selection = $getSelection();
- invariant(
- $isRangeSelection(selection),
- 'isRangeSelection(selection)',
- );
- $insertDataTransferForRichText(dataTransfer, selection, editor);
- });
- expect(testEnv.innerHTML).toBe(testCase.expectedHTML);
- });
- });
- },
- {
- namespace: 'test',
- theme: {
- text: {
- bold: 'editor-text-bold',
- italic: 'editor-text-italic',
- underline: 'editor-text-underline',
- },
- },
- },
- );
-});
diff --git a/resources/js/wysiwyg/lexical/core/__tests__/unit/HTMLCopyAndPaste.test.ts b/resources/js/wysiwyg/lexical/core/__tests__/unit/HTMLCopyAndPaste.test.ts
index b14654838..056de19e4 100644
--- a/resources/js/wysiwyg/lexical/core/__tests__/unit/HTMLCopyAndPaste.test.ts
+++ b/resources/js/wysiwyg/lexical/core/__tests__/unit/HTMLCopyAndPaste.test.ts
@@ -17,7 +17,7 @@ import {
DataTransferMock,
initializeUnitTest,
invariant,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
describe('HTMLCopyAndPaste tests', () => {
initializeUnitTest(
diff --git a/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalEditor.test.ts b/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalEditor.test.ts
index 4ca6b77c8..4e3e622ce 100644
--- a/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalEditor.test.ts
+++ b/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalEditor.test.ts
@@ -57,11 +57,13 @@ import {
describe('LexicalEditor tests', () => {
let container: HTMLElement;
- let reactRoot: Root;
+ function setContainerChild(el: HTMLElement) {
+ container.innerHTML = '';
+ container.append(el);
+ }
beforeEach(() => {
container = document.createElement('div');
- reactRoot = createRoot(container);
document.body.appendChild(container);
});
@@ -74,49 +76,33 @@ describe('LexicalEditor tests', () => {
});
function useLexicalEditor(
- rootElementRef: React.RefObject,
+ rootElement: HTMLDivElement,
onError?: (error: Error) => void,
nodes?: ReadonlyArray | LexicalNodeReplacement>,
) {
- const editor = useMemo(
- () =>
- createTestEditor({
- nodes: nodes ?? [],
- onError: onError || jest.fn(),
- theme: {
- text: {
- bold: 'editor-text-bold',
- italic: 'editor-text-italic',
- underline: 'editor-text-underline',
- },
- },
- }),
- [onError, nodes],
- );
-
- useEffect(() => {
- const rootElement = rootElementRef.current;
-
- editor.setRootElement(rootElement);
- }, [rootElementRef, editor]);
-
+ const editor = createTestEditor({
+ nodes: nodes ?? [],
+ onError: onError || jest.fn(),
+ theme: {
+ text: {
+ bold: 'editor-text-bold',
+ italic: 'editor-text-italic',
+ underline: 'editor-text-underline',
+ },
+ },
+ });
+ editor.setRootElement(rootElement);
return editor;
}
let editor: LexicalEditor;
function init(onError?: (error: Error) => void) {
- const ref = createRef();
+ const edContainer = document.createElement('div');
+ edContainer.setAttribute('contenteditable', 'true');
- function TestBase() {
- editor = useLexicalEditor(ref, onError);
-
- return ;
- }
-
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ setContainerChild(edContainer);
+ editor = useLexicalEditor(edContainer, onError);
}
async function update(fn: () => void) {
@@ -870,21 +856,12 @@ describe('LexicalEditor tests', () => {
});
it('Should be able to update an editor state without a root element', () => {
- const ref = createRef();
+ const element = document.createElement('div');
+ element.setAttribute('contenteditable', 'true');
+ setContainerChild(element);
- function TestBase({element}: {element: HTMLElement | null}) {
- editor = useMemo(() => createTestEditor(), []);
+ editor = createTestEditor();
- useEffect(() => {
- editor.setRootElement(element);
- }, [element]);
-
- return ;
- }
-
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
editor.update(() => {
const root = $getRoot();
const paragraph = $createParagraphNode();
@@ -895,9 +872,7 @@ describe('LexicalEditor tests', () => {
expect(container.innerHTML).toBe('');
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ editor.setRootElement(element);
expect(container.innerHTML).toBe(
'This works!
',
@@ -945,57 +920,48 @@ describe('LexicalEditor tests', () => {
const rootListener = jest.fn();
const updateListener = jest.fn();
- function TestBase({changeElement}: {changeElement: boolean}) {
- editor = useMemo(() => createTestEditor(), []);
+ let editorInstance = createTestEditor();
+ editorInstance.registerRootListener(rootListener);
+ editorInstance.registerUpdateListener(updateListener);
- useEffect(() => {
- editor.update(() => {
- const root = $getRoot();
- const firstChild = root.getFirstChild() as ParagraphNode | null;
- const text = changeElement ? 'Change successful' : 'Not changed';
+ let edContainer: HTMLElement = document.createElement('div');
+ edContainer.setAttribute('contenteditable', 'true');
+ setContainerChild(edContainer);
+ editorInstance.setRootElement(edContainer);
- if (firstChild === null) {
- const paragraph = $createParagraphNode();
- const textNode = $createTextNode(text);
- paragraph.append(textNode);
- root.append(paragraph);
- } else {
- const textNode = firstChild.getFirstChild() as TextNode;
- textNode.setTextContent(text);
- }
- });
- }, [changeElement]);
+ function runUpdate(changeElement: boolean) {
+ editorInstance.update(() => {
+ const root = $getRoot();
+ const firstChild = root.getFirstChild() as ParagraphNode | null;
+ const text = changeElement ? 'Change successful' : 'Not changed';
- useEffect(() => {
- return editor.registerRootListener(rootListener);
- }, []);
-
- useEffect(() => {
- return editor.registerUpdateListener(updateListener);
- }, []);
-
- const ref = useCallback((node: HTMLElement | null) => {
- editor.setRootElement(node);
- }, []);
-
- return changeElement ? (
-
- ) : (
-
- );
+ if (firstChild === null) {
+ const paragraph = $createParagraphNode();
+ const textNode = $createTextNode(text);
+ paragraph.append(textNode);
+ root.append(paragraph);
+ } else {
+ const textNode = firstChild.getFirstChild() as TextNode;
+ textNode.setTextContent(text);
+ }
+ });
}
- await ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ setContainerChild(edContainer);
+ editorInstance.setRootElement(edContainer);
+ runUpdate(false);
+ editorInstance.commitUpdates();
expect(container.innerHTML).toBe(
'Not changed
',
);
- await ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ edContainer = document.createElement('span');
+ edContainer.setAttribute('contenteditable', 'true');
+ runUpdate(true);
+ editorInstance.setRootElement(edContainer);
+ setContainerChild(edContainer);
+ editorInstance.commitUpdates();
expect(rootListener).toHaveBeenCalledTimes(3);
expect(updateListener).toHaveBeenCalledTimes(3);
@@ -1026,178 +992,6 @@ describe('LexicalEditor tests', () => {
});
}
- describe('With node decorators', () => {
- function useDecorators() {
- const [decorators, setDecorators] = useState(() =>
- editor.getDecorators(),
- );
-
- // Subscribe to changes
- useEffect(() => {
- return editor.registerDecoratorListener((nextDecorators) => {
- setDecorators(nextDecorators);
- });
- }, []);
-
- const decoratedPortals = useMemo(
- () =>
- Object.keys(decorators).map((nodeKey) => {
- const reactDecorator = decorators[nodeKey];
- const element = editor.getElementByKey(nodeKey)!;
-
- return createPortal(reactDecorator, element);
- }),
- [decorators],
- );
-
- return decoratedPortals;
- }
-
- afterEach(async () => {
- // Clean up so we are not calling setState outside of act
- await ReactTestUtils.act(async () => {
- reactRoot.render(null);
- await Promise.resolve().then();
- });
- });
-
- it('Should correctly render React component into Lexical node #1', async () => {
- const listener = jest.fn();
-
- function Test() {
- editor = useMemo(() => createTestEditor(), []);
-
- useEffect(() => {
- editor.registerRootListener(listener);
- }, []);
-
- const ref = useCallback((node: HTMLDivElement | null) => {
- editor.setRootElement(node);
- }, []);
-
- const decorators = useDecorators();
-
- return (
- <>
-
- {decorators}
- >
- );
- }
-
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
- // Update the editor with the decorator
- await ReactTestUtils.act(async () => {
- await editor.update(() => {
- const paragraph = $createParagraphNode();
- const test = $createTestDecoratorNode();
- paragraph.append(test);
- $getRoot().append(paragraph);
- });
- });
-
- expect(listener).toHaveBeenCalledTimes(1);
- expect(container.innerHTML).toBe(
- '' +
- 'Hello world
',
- );
- });
-
- it('Should correctly render React component into Lexical node #2', async () => {
- const listener = jest.fn();
-
- function Test({divKey}: {divKey: number}): JSX.Element {
- function TestPlugin() {
- [editor] = useLexicalComposerContext();
-
- useEffect(() => {
- return editor.registerRootListener(listener);
- }, []);
-
- return null;
- }
-
- return (
-
-
- }
- placeholder={null}
- ErrorBoundary={LexicalErrorBoundary}
- />
-
-
- );
- }
-
- await ReactTestUtils.act(async () => {
- reactRoot.render( );
- // Wait for update to complete
- await Promise.resolve().then();
- });
-
- expect(listener).toHaveBeenCalledTimes(1);
- expect(container.innerHTML).toBe(
- '
',
- );
-
- await ReactTestUtils.act(async () => {
- reactRoot.render( );
- // Wait for update to complete
- await Promise.resolve().then();
- });
-
- expect(listener).toHaveBeenCalledTimes(5);
- expect(container.innerHTML).toBe(
- '
',
- );
-
- // Wait for update to complete
- await Promise.resolve().then();
-
- editor.getEditorState().read(() => {
- const root = $getRoot();
- const paragraph = root.getFirstChild()!;
- expect(root).toEqual({
- __cachedText: '',
- __dir: null,
- __first: paragraph.getKey(),
- __format: 0,
- __indent: 0,
- __key: 'root',
- __last: paragraph.getKey(),
- __next: null,
- __parent: null,
- __prev: null,
- __size: 1,
- __style: '',
- __type: 'root',
- });
- expect(paragraph).toEqual({
- __dir: null,
- __first: null,
- __format: 0,
- __indent: 0,
- __key: paragraph.getKey(),
- __last: null,
- __next: null,
- __parent: 'root',
- __prev: null,
- __size: 0,
- __style: '',
- __textFormat: 0,
- __textStyle: '',
- __type: 'paragraph',
- });
- });
- });
- });
-
describe('parseEditorState()', () => {
let originalText: TextNode;
let parsedParagraph: ParagraphNode;
@@ -1872,10 +1666,12 @@ describe('LexicalEditor tests', () => {
});
it('mutation listener set for original node should work with the replaced node', async () => {
- const ref = createRef();
function TestBase() {
- editor = useLexicalEditor(ref, undefined, [
+ const edContainer = document.createElement('div');
+ edContainer.contentEditable = 'true';
+
+ editor = useLexicalEditor(edContainer, undefined, [
TestTextNode,
{
replace: TextNode,
@@ -1884,12 +1680,10 @@ describe('LexicalEditor tests', () => {
},
]);
- return ;
+ return edContainer;
}
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ setContainerChild(TestBase());
const textNodeMutations = jest.fn();
const textNodeMutationsB = jest.fn();
@@ -1969,10 +1763,12 @@ describe('LexicalEditor tests', () => {
});
it('mutation listener should work with the replaced node', async () => {
- const ref = createRef();
function TestBase() {
- editor = useLexicalEditor(ref, undefined, [
+ const edContainer = document.createElement('div');
+ edContainer.contentEditable = 'true';
+
+ editor = useLexicalEditor(edContainer, undefined, [
TestTextNode,
{
replace: TextNode,
@@ -1981,12 +1777,10 @@ describe('LexicalEditor tests', () => {
},
]);
- return ;
+ return edContainer;
}
- ReactTestUtils.act(() => {
- reactRoot.render( );
- });
+ setContainerChild(TestBase());
const textNodeMutations = jest.fn();
const textNodeMutationsB = jest.fn();
@@ -2581,6 +2375,8 @@ describe('LexicalEditor tests', () => {
expect(false).toBe('unreachable');
});
+ newEditor.commitUpdates();
+
expect(onError).toHaveBeenCalledWith(
expect.objectContaining({
message: expect.stringMatching(/TestTextNode.*re-use key.*TextNode/),
diff --git a/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalListPlugin.test.tsx b/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalListPlugin.test.tsx
index a2968c259..5493b6962 100644
--- a/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalListPlugin.test.tsx
+++ b/resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalListPlugin.test.tsx
@@ -20,7 +20,7 @@ import {
expectHtmlToBeEqual,
html,
TestComposer,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {createRoot, Root} from 'react-dom/client';
import * as ReactTestUtils from 'lexical/shared/react-test-utils';
diff --git a/resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts b/resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts
index b7ccfab1e..090ace10d 100644
--- a/resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts
+++ b/resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts
@@ -29,7 +29,6 @@ import {
SerializedTextNode,
TextNode,
} from 'lexical';
-import * as ReactTestUtils from 'lexical/shared/react-test-utils';
import {
CreateEditorArgs,
@@ -89,38 +88,13 @@ export function initializeUnitTest(
testEnv.container = document.createElement('div');
document.body.appendChild(testEnv.container);
- const useLexicalEditor = (
- rootElementRef: React.RefObject,
- ) => {
- const lexicalEditor = React.useMemo(() => {
- const lexical = createTestEditor(editorConfig);
- return lexical;
- }, []);
+ const editorEl = document.createElement('div');
+ editorEl.contentEditable = 'true';
+ testEnv.container.append(editorEl);
- React.useEffect(() => {
- const rootElement = rootElementRef.current;
- lexicalEditor.setRootElement(rootElement);
- }, [rootElementRef, lexicalEditor]);
- return lexicalEditor;
- };
-
- const Editor = () => {
- testEnv.editor = useLexicalEditor(ref);
- const context = createLexicalComposerContext(
- null,
- editorConfig?.theme ?? {},
- );
- return (
-
-
- {plugins}
-
- );
- };
-
- ReactTestUtils.act(() => {
- createRoot(testEnv.container).render( );
- });
+ const lexicalEditor = createTestEditor(editorConfig);
+ lexicalEditor.setRootElement(editorEl);
+ testEnv.editor = lexicalEditor;
});
afterEach(() => {
@@ -381,7 +355,7 @@ export function $createTestExcludeFromCopyElementNode(): TestExcludeFromCopyElem
export type SerializedTestDecoratorNode = SerializedLexicalNode;
-export class TestDecoratorNode extends DecoratorNode {
+export class TestDecoratorNode extends DecoratorNode {
static getType(): string {
return 'test_decorator';
}
@@ -433,32 +407,26 @@ export class TestDecoratorNode extends DecoratorNode {
}
decorate() {
- return ;
+ const decorator = document.createElement('span');
+ decorator.textContent = 'Hello world';
+ return decorator;
}
}
-function Decorator({text}: {text: string}): JSX.Element {
- return {text};
-}
-
export function $createTestDecoratorNode(): TestDecoratorNode {
return new TestDecoratorNode();
}
-const DEFAULT_NODES: NonNullable = [
+const DEFAULT_NODES: NonNullable | LexicalNodeReplacement>> = [
HeadingNode,
ListNode,
ListItemNode,
QuoteNode,
- CodeNode,
TableNode,
TableCellNode,
TableRowNode,
- HashtagNode,
- CodeHighlightNode,
AutoLinkNode,
LinkNode,
- OverflowNode,
TestElementNode,
TestSegmentedNode,
TestExcludeFromCopyElementNode,
diff --git a/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalAutoLinkNode.test.ts b/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalAutoLinkNode.test.ts
index 8ef2aa051..ffcefd7c8 100644
--- a/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalAutoLinkNode.test.ts
+++ b/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalAutoLinkNode.test.ts
@@ -20,7 +20,7 @@ import {
SerializedParagraphNode,
TextNode,
} from 'lexical/src';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalLinkNode.test.ts b/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalLinkNode.test.ts
index 3ad6cbad8..fe978849b 100644
--- a/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalLinkNode.test.ts
+++ b/resources/js/wysiwyg/lexical/link/__tests__/unit/LexicalLinkNode.test.ts
@@ -20,7 +20,7 @@ import {
SerializedParagraphNode,
TextNode,
} from 'lexical/src';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListItemNode.test.ts b/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListItemNode.test.ts
index d36b8f1cb..a1ccd5020 100644
--- a/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListItemNode.test.ts
+++ b/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListItemNode.test.ts
@@ -16,7 +16,7 @@ import {
expectHtmlToBeEqual,
html,
initializeUnitTest,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {
$createListItemNode,
diff --git a/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListNode.test.ts b/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListNode.test.ts
index 6abcbbd4c..497e096b1 100644
--- a/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListNode.test.ts
+++ b/resources/js/wysiwyg/lexical/list/__tests__/unit/LexicalListNode.test.ts
@@ -6,7 +6,7 @@
*
*/
import {ParagraphNode, TextNode} from 'lexical';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
import {
$createListItemNode,
diff --git a/resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts b/resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts
index 1fa327379..ba3971289 100644
--- a/resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts
+++ b/resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts
@@ -6,7 +6,7 @@
*
*/
import {$createParagraphNode, $getRoot} from 'lexical';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
import {$createListItemNode, $createListNode} from '../..';
import {$getListDepth, $getTopListNode, $isLastItemInList} from '../../utils';
diff --git a/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalHeadingNode.test.ts b/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalHeadingNode.test.ts
index 057999ba0..dcbd62ab3 100644
--- a/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalHeadingNode.test.ts
+++ b/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalHeadingNode.test.ts
@@ -18,7 +18,7 @@ import {
ParagraphNode,
RangeSelection,
} from 'lexical';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalQuoteNode.test.ts b/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalQuoteNode.test.ts
index e64c41880..66374bf5f 100644
--- a/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalQuoteNode.test.ts
+++ b/resources/js/wysiwyg/lexical/rich-text/__tests__/unit/LexicalQuoteNode.test.ts
@@ -8,7 +8,7 @@
import {$createQuoteNode, QuoteNode} from '@lexical/rich-text';
import {$createRangeSelection, $getRoot, ParagraphNode} from 'lexical';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelection.test.tsx b/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelection.test.tsx
index e60867831..68e9dcab5 100644
--- a/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelection.test.tsx
+++ b/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelection.test.tsx
@@ -50,7 +50,7 @@ import {
initializeClipboard,
invariant,
TestComposer,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {createRoot, Root} from 'react-dom/client';
import * as ReactTestUtils from 'lexical/shared/react-test-utils';
diff --git a/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts b/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts
index 01390ed71..7b5bef451 100644
--- a/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts
+++ b/resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts
@@ -41,7 +41,7 @@ import {
createTestHeadlessEditor,
invariant,
TestDecoratorNode,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {$setAnchorPoint, $setFocusPoint} from '../utils';
diff --git a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableCellNode.test.ts b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableCellNode.test.ts
index 9c56db63b..70b327866 100644
--- a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableCellNode.test.ts
+++ b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableCellNode.test.ts
@@ -7,7 +7,7 @@
*/
import {$createTableCellNode, TableCellHeaderStates} from '@lexical/table';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableNode.test.tsx b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableNode.test.tsx
index b11b99490..37049e598 100644
--- a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableNode.test.tsx
+++ b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableNode.test.tsx
@@ -28,7 +28,7 @@ import {
DataTransferMock,
initializeUnitTest,
invariant,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {$getElementForTableNode, TableNode} from '../../LexicalTableNode';
diff --git a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableRowNode.test.ts b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableRowNode.test.ts
index cf110634b..285d587bf 100644
--- a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableRowNode.test.ts
+++ b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableRowNode.test.ts
@@ -7,7 +7,7 @@
*/
import {$createTableRowNode} from '@lexical/table';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
const editorConfig = Object.freeze({
namespace: '',
diff --git a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableSelection.test.tsx b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableSelection.test.tsx
index 5eb631c31..9e9dbac81 100644
--- a/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableSelection.test.tsx
+++ b/resources/js/wysiwyg/lexical/table/__tests__/unit/LexicalTableSelection.test.tsx
@@ -18,7 +18,7 @@ import {
RootNode,
TextNode,
} from 'lexical';
-import {createTestEditor} from 'lexical/src/__tests__/utils';
+import {createTestEditor} from 'lexical/__tests__/utils';
import {createRef, useEffect, useMemo} from 'react';
import {createRoot, Root} from 'react-dom/client';
import * as ReactTestUtils from 'lexical/shared/react-test-utils';
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.tsx b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.tsx
index 2b49e3bd7..2d5db2c69 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.tsx
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.tsx
@@ -23,7 +23,7 @@ import {
} from '@lexical/selection/src/__tests__/utils';
import {TableCellNode, TableNode, TableRowNode} from '@lexical/table';
import {LexicalEditor} from 'lexical';
-import {initializeClipboard, TestComposer} from 'lexical/src/__tests__/utils';
+import {initializeClipboard, TestComposer} from 'lexical/__tests__/utils';
import {createRoot} from 'react-dom/client';
import * as ReactTestUtils from 'lexical/shared/react-test-utils';
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalNodeHelpers.test.ts b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalNodeHelpers.test.ts
index 82d2dddf8..1d994e140 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalNodeHelpers.test.ts
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalNodeHelpers.test.ts
@@ -19,7 +19,7 @@ import {
$createTestElementNode,
initializeUnitTest,
invariant,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {$dfs} from '../..';
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalRootHelpers.test.ts b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalRootHelpers.test.ts
index 070107583..369caaea4 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalRootHelpers.test.ts
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalRootHelpers.test.ts
@@ -12,7 +12,7 @@ import {
$rootTextContent,
} from '@lexical/text';
import {$createParagraphNode, $createTextNode, $getRoot} from 'lexical';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
describe('LexicalRootHelpers tests', () => {
initializeUnitTest((testEnv) => {
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsKlassEqual.test.ts b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsKlassEqual.test.ts
index b4b18ef01..a62b7bae1 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsKlassEqual.test.ts
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsKlassEqual.test.ts
@@ -7,7 +7,7 @@
*/
import {objectKlassEquals} from '@lexical/utils';
-import {initializeUnitTest} from 'lexical/src/__tests__/utils';
+import {initializeUnitTest} from 'lexical/__tests__/utils';
class MyEvent extends Event {}
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsSplitNode.test.tsx b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsSplitNode.test.tsx
index f3db39390..f04bb5d2e 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsSplitNode.test.tsx
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalUtilsSplitNode.test.tsx
@@ -10,7 +10,7 @@ import type {ElementNode, LexicalEditor} from 'lexical';
import {$generateHtmlFromNodes, $generateNodesFromDOM} from '@lexical/html';
import {$getRoot, $isElementNode} from 'lexical';
-import {createTestEditor} from 'lexical/src/__tests__/utils';
+import {createTestEditor} from 'lexical/__tests__/utils';
import {$splitNode} from '../../index';
diff --git a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexlcaiUtilsInsertNodeToNearestRoot.test.tsx b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexlcaiUtilsInsertNodeToNearestRoot.test.tsx
index 0e46573e7..9664b2d80 100644
--- a/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexlcaiUtilsInsertNodeToNearestRoot.test.tsx
+++ b/resources/js/wysiwyg/lexical/utils/__tests__/unit/LexlcaiUtilsInsertNodeToNearestRoot.test.tsx
@@ -18,7 +18,7 @@ import {
import {
$createTestDecoratorNode,
createTestEditor,
-} from 'lexical/src/__tests__/utils';
+} from 'lexical/__tests__/utils';
import {$insertNodeToNearestRoot} from '../..';