You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Chore: Mobile: Add note screen tests (#10766)
This commit is contained in:
@@ -14,6 +14,7 @@ import { HandleMessageCallback, OnMarkForDownloadCallback } from './hooks/useOnM
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import getWebViewDomById from '../../utils/testing/getWebViewDomById';
|
||||
|
||||
interface WrapperProps {
|
||||
noteBody: string;
|
||||
@@ -56,17 +57,8 @@ const WrappedNoteViewer: React.FC<WrapperProps> = (
|
||||
</MenuProvider>;
|
||||
};
|
||||
|
||||
const getNoteViewerDom = async (): Promise<Document> => {
|
||||
const webviewContent = await screen.findByTestId('NoteBodyViewer');
|
||||
expect(webviewContent).toBeVisible();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(!!webviewContent.props.document).toBe(true);
|
||||
});
|
||||
|
||||
// Return the composite ExtendedWebView component
|
||||
// See https://callstack.github.io/react-native-testing-library/docs/advanced/testing-env#tree-navigation
|
||||
return webviewContent.props.document;
|
||||
const getNoteViewerDom = async () => {
|
||||
return await getWebViewDomById('NoteBodyViewer');
|
||||
};
|
||||
|
||||
describe('NoteBodyViewer', () => {
|
||||
|
||||
Reference in New Issue
Block a user