1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Lexical: Finished conversion/update of test files

This commit is contained in:
Dan Brown
2024-09-20 15:31:19 +01:00
parent 787e06e3d8
commit dba8ab947f
15 changed files with 578 additions and 1244 deletions

View File

@@ -717,3 +717,11 @@ export function html(
}
return output;
}
export function expectHtmlToBeEqual(expected: string, actual: string): void {
expect(formatHtml(expected)).toBe(formatHtml(actual));
}
function formatHtml(s: string): string {
return s.replace(/>\s+</g, '><').replace(/\s*\n\s*/g, ' ').trim();
}

View File

@@ -21,7 +21,6 @@ import {
TextModeType,
TextNode,
} from 'lexical';
import * as ReactTestUtils from 'lexical/shared/react-test-utils';
import {
$createTestSegmentedNode,

View File

@@ -1,18 +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 * as React from 'react';
import * as ReactTestUtils from 'react-dom/test-utils';
/**
* React 19 moved act from react-dom/test-utils to react
* https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-react-dom-test-utils
*/
export const act =
'act' in React
? (React.act as typeof ReactTestUtils.act)
: ReactTestUtils.act;