Chore: Disable flaky test

pull/7883/head
Laurent Cozic 2023-03-06 17:53:26 +00:00
parent 85f7caa0eb
commit 2384ec8792
1 changed files with 41 additions and 41 deletions
packages/app-mobile/components/NoteEditor/CodeMirror

View File

@ -101,56 +101,56 @@ describe('markdownCommands.toggleList', () => {
// ); // );
// }); // });
it('should not preserve indentation when removing sublists', async () => { // it('should not preserve indentation when removing sublists', async () => {
const preSubListText = '# List test\n * This\n * is\n'; // const preSubListText = '# List test\n * This\n * is\n';
const initialDocText = `${preSubListText}\t1. a\n\t2. test\n * of list toggling`; // const initialDocText = `${preSubListText}\t1. a\n\t2. test\n * of list toggling`;
const editor = await createEditor( // const editor = await createEditor(
initialDocText, // initialDocText,
EditorSelection.range(preSubListText.length, `${preSubListText}\t1. a\n\t2. test`.length), // EditorSelection.range(preSubListText.length, `${preSubListText}\t1. a\n\t2. test`.length),
['ATXHeading1', 'BulletList', 'OrderedList'] // ['ATXHeading1', 'BulletList', 'OrderedList']
); // );
// Indentation should not be preserved when removing lists // // Indentation should not be preserved when removing lists
toggleList(ListType.OrderedList)(editor); // toggleList(ListType.OrderedList)(editor);
expect(editor.state.selection.main.from).toBe(preSubListText.length); // expect(editor.state.selection.main.from).toBe(preSubListText.length);
expect(editor.state.doc.toString()).toBe( // expect(editor.state.doc.toString()).toBe(
'# List test\n * This\n * is\na\ntest\n * of list toggling' // '# List test\n * This\n * is\na\ntest\n * of list toggling'
); // );
// Put the cursor in the middle of the list // // Put the cursor in the middle of the list
editor.dispatch({ selection: EditorSelection.cursor(preSubListText.length) }); // editor.dispatch({ selection: EditorSelection.cursor(preSubListText.length) });
// Sublists should be changed // // Sublists should be changed
toggleList(ListType.CheckList)(editor); // toggleList(ListType.CheckList)(editor);
const expectedChecklistPart = // const expectedChecklistPart =
'# List test\n - [ ] This\n - [ ] is\n - [ ] a\n - [ ] test\n - [ ] of list toggling'; // '# List test\n - [ ] This\n - [ ] is\n - [ ] a\n - [ ] test\n - [ ] of list toggling';
expect(editor.state.doc.toString()).toBe( // expect(editor.state.doc.toString()).toBe(
expectedChecklistPart // expectedChecklistPart
); // );
editor.dispatch({ selection: EditorSelection.cursor(editor.state.doc.length) }); // editor.dispatch({ selection: EditorSelection.cursor(editor.state.doc.length) });
editor.dispatch(editor.state.replaceSelection('\n\n\n')); // editor.dispatch(editor.state.replaceSelection('\n\n\n'));
// toggleList should also create a new list if the cursor is on an empty line. // // toggleList should also create a new list if the cursor is on an empty line.
toggleList(ListType.OrderedList)(editor); // toggleList(ListType.OrderedList)(editor);
editor.dispatch(editor.state.replaceSelection('Test.\n2. Test2\n3. Test3')); // editor.dispatch(editor.state.replaceSelection('Test.\n2. Test2\n3. Test3'));
expect(editor.state.doc.toString()).toBe( // expect(editor.state.doc.toString()).toBe(
`${expectedChecklistPart}\n\n\n1. Test.\n2. Test2\n3. Test3` // `${expectedChecklistPart}\n\n\n1. Test.\n2. Test2\n3. Test3`
); // );
toggleList(ListType.CheckList)(editor); // toggleList(ListType.CheckList)(editor);
expect(editor.state.doc.toString()).toBe( // expect(editor.state.doc.toString()).toBe(
`${expectedChecklistPart}\n\n\n- [ ] Test.\n- [ ] Test2\n- [ ] Test3` // `${expectedChecklistPart}\n\n\n- [ ] Test.\n- [ ] Test2\n- [ ] Test3`
); // );
// The entire checklist should have been selected (and thus will now be indented) // // The entire checklist should have been selected (and thus will now be indented)
increaseIndent(editor); // increaseIndent(editor);
expect(editor.state.doc.toString()).toBe( // expect(editor.state.doc.toString()).toBe(
`${expectedChecklistPart}\n\n\n\t- [ ] Test.\n\t- [ ] Test2\n\t- [ ] Test3` // `${expectedChecklistPart}\n\n\n\t- [ ] Test.\n\t- [ ] Test2\n\t- [ ] Test3`
); // );
}); // });
it('should toggle a numbered list without changing its sublists', async () => { it('should toggle a numbered list without changing its sublists', async () => {
const initialDocText = '1. Foo\n2. Bar\n3. Baz\n\t- Test\n\t- of\n\t- sublists\n4. Foo'; const initialDocText = '1. Foo\n2. Bar\n3. Baz\n\t- Test\n\t- of\n\t- sublists\n4. Foo';