1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Lexical: Aligned new empty item behaviour for nested lists

- Makes enter on empty nested list item un-nest instead of just creating
  new list items.
- Also updated existing lists tests to use newer helper setup.
This commit is contained in:
Dan Brown
2024-12-17 16:50:03 +00:00
parent ace8af077d
commit fca8f928a3
4 changed files with 635 additions and 617 deletions

View File

@ -48,7 +48,6 @@ describe('Keyboard-handling service tests', () => {
expect(lastRootChild).toBeInstanceOf(DetailsNode);
dispatchKeydownEventForNode(detailsPara, editor, 'ArrowDown');
editor.commitUpdates();
editor.getEditorState().read(() => {
lastRootChild = $getRoot().getLastChild();
@ -79,10 +78,7 @@ describe('Keyboard-handling service tests', () => {
expect(lastRootChild).toBeInstanceOf(DetailsNode);
dispatchKeydownEventForNode(detailsPara, editor, 'Enter');
editor.commitUpdates();
dispatchKeydownEventForSelectedNode(editor, 'Enter');
editor.commitUpdates();
let detailsChildren!: LexicalNode[];
let lastDetailsText!: string;
@ -115,7 +111,6 @@ describe('Keyboard-handling service tests', () => {
});
dispatchKeydownEventForNode(listItemB, editor, 'Tab');
editor.commitUpdates();
editor.getEditorState().read(() => {
const list = $getRoot().getChildren()[0] as ListNode;