You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Chore: Mobile: Fix Note.test.tsx warnings (#12448)
This commit is contained in:
@ -15,6 +15,18 @@ import CodeMirrorControl from '@joplin/editor/CodeMirror/CodeMirrorControl';
|
|||||||
import WebViewToRNMessenger from '../../../utils/ipc/WebViewToRNMessenger';
|
import WebViewToRNMessenger from '../../../utils/ipc/WebViewToRNMessenger';
|
||||||
import { WebViewToEditorApi } from '../types';
|
import { WebViewToEditorApi } from '../types';
|
||||||
import { focus } from '@joplin/lib/utils/focusHandler';
|
import { focus } from '@joplin/lib/utils/focusHandler';
|
||||||
|
import Logger, { TargetType } from '@joplin/utils/Logger';
|
||||||
|
|
||||||
|
let loggerCreated = false;
|
||||||
|
export const setUpLogger = () => {
|
||||||
|
if (!loggerCreated) {
|
||||||
|
const logger = new Logger();
|
||||||
|
logger.addTarget(TargetType.Console);
|
||||||
|
logger.setLevel(Logger.LEVEL_WARN);
|
||||||
|
Logger.initializeGlobalLogger(logger);
|
||||||
|
loggerCreated = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const initCodeMirror = (
|
export const initCodeMirror = (
|
||||||
parentElement: HTMLElement,
|
parentElement: HTMLElement,
|
||||||
|
@ -387,6 +387,7 @@ function NoteEditor(props: Props, ref: any) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
${shim.injectedJs('codeMirrorBundle')};
|
${shim.injectedJs('codeMirrorBundle')};
|
||||||
|
codeMirrorBundle.setUpLogger();
|
||||||
|
|
||||||
const parentElement = document.getElementsByClassName('CodeMirror')[0];
|
const parentElement = document.getElementsByClassName('CodeMirror')[0];
|
||||||
// On Android, injectJavaScript is run twice -- once before the parent element exists.
|
// On Android, injectJavaScript is run twice -- once before the parent element exists.
|
||||||
|
@ -292,7 +292,7 @@ describe('screens/Note', () => {
|
|||||||
const deleteButton = await screen.findByText('Delete');
|
const deleteButton = await screen.findByText('Delete');
|
||||||
expect(deleteButton).toBeDisabled();
|
expect(deleteButton).toBeDisabled();
|
||||||
|
|
||||||
cleanup();
|
act(() => cleanup());
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
Reference in New Issue
Block a user