2 * Copyright (c) Meta Platforms, Inc. and affiliates.
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
8 import {AutoLinkNode, LinkNode} from '@lexical/link';
9 import {ListItemNode, ListNode} from '@lexical/list';
10 import {registerRichText} from '@lexical/rich-text';
14 } from '@lexical/selection/__tests__/utils';
15 import {TableCellNode, TableNode, TableRowNode} from '@lexical/table';
16 import {$createParagraphNode, $insertNodes, LexicalEditor} from 'lexical';
17 import {createTestEditor, initializeClipboard} from 'lexical/__tests__/utils';
18 import {HeadingNode} from "@lexical/rich-text/LexicalHeadingNode";
19 import {QuoteNode} from "@lexical/rich-text/LexicalQuoteNode";
21 jest.mock('lexical/shared/environment', () => {
22 const originalModule = jest.requireActual('lexical/shared/environment');
23 return {...originalModule, IS_FIREFOX: true};
26 Range.prototype.getBoundingClientRect = function (): DOMRect {
45 initializeClipboard();
47 Range.prototype.getBoundingClientRect = function (): DOMRect {
66 describe('LexicalEventHelpers', () => {
67 let container: HTMLDivElement | null = null;
69 beforeEach(async () => {
70 container = document.createElement('div');
71 document.body.appendChild(container);
76 document.body.removeChild(container!);
80 let editor: LexicalEditor | null = null;
82 async function init() {
99 h1: 'editor-heading-h1',
100 h2: 'editor-heading-h2',
101 h3: 'editor-heading-h3',
102 h4: 'editor-heading-h4',
103 h5: 'editor-heading-h5',
104 h6: 'editor-heading-h6',
106 image: 'editor-image',
108 listitem: 'editor-listitem',
109 olDepth: ['editor-list-ol'],
110 ulDepth: ['editor-list-ul'],
112 paragraph: 'editor-paragraph',
113 placeholder: 'editor-placeholder',
114 quote: 'editor-quote',
116 bold: 'editor-text-bold',
117 code: 'editor-text-code',
118 hashtag: 'editor-text-hashtag',
119 italic: 'editor-text-italic',
120 link: 'editor-text-link',
121 strikethrough: 'editor-text-strikethrough',
122 underline: 'editor-text-underline',
123 underlineStrikethrough: 'editor-text-underlineStrikethrough',
128 editor = createTestEditor(config);
129 registerRichText(editor);
131 const root = document.createElement('div');
132 root.setAttribute('contenteditable', 'true');
133 container?.append(root);
135 editor.setRootElement(root);
137 editor.update(() => {
138 $insertNodes([$createParagraphNode()])
140 editor.commitUpdates();
143 async function update(fn: () => void) {
144 await editor!.update(fn);
145 editor?.commitUpdates();
147 return Promise.resolve().then();
150 test('Expect initial output to be a block with no text', () => {
151 expect(container!.innerHTML).toBe(
152 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><br></p></div>',
156 describe('onPasteForRichText', () => {
157 describe('baseline', () => {
161 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><h1 class="editor-heading-h1"><span data-lexical-text="true">Hello</span></h1></div>',
162 inputs: [pasteHTML(`<meta charset='utf-8'><h1>Hello</h1>`)],
163 name: 'should produce the correct editor state from a pasted HTML h1 element',
167 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><h2 class="editor-heading-h2"><span data-lexical-text="true">From</span></h2></div>',
168 inputs: [pasteHTML(`<meta charset='utf-8'><h2>From</h2>`)],
169 name: 'should produce the correct editor state from a pasted HTML h2 element',
173 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><h3 class="editor-heading-h3"><span data-lexical-text="true">The</span></h3></div>',
174 inputs: [pasteHTML(`<meta charset='utf-8'><h3>The</h3>`)],
175 name: 'should produce the correct editor state from a pasted HTML h3 element',
179 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><ul class="editor-list-ul"><li value="1" class="editor-listitem"><span data-lexical-text="true">Other side</span></li><li value="2" class="editor-listitem"><span data-lexical-text="true">I must have called</span></li></ul></div>',
182 `<meta charset='utf-8'><ul><li>Other side</li><li>I must have called</li></ul>`,
185 name: 'should produce the correct editor state from a pasted HTML ul element',
189 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><ol class="editor-list-ol"><li value="1" class="editor-listitem"><span data-lexical-text="true">To tell you</span></li><li value="2" class="editor-listitem"><span data-lexical-text="true">I’m sorry</span></li></ol></div>',
192 `<meta charset='utf-8'><ol><li>To tell you</li><li>I’m sorry</li></ol>`,
195 name: 'should produce the correct editor state from pasted HTML ol element',
199 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">A thousand times</span></p></div>',
200 inputs: [pasteHTML(`<meta charset='utf-8'>A thousand times`)],
201 name: 'should produce the correct editor state from pasted DOM Text Node',
205 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">Bold</strong></p></div>',
206 inputs: [pasteHTML(`<meta charset='utf-8'><b>Bold</b>`)],
207 name: 'should produce the correct editor state from a pasted HTML b element',
211 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><em class="editor-text-italic" data-lexical-text="true">Italic</em></p></div>',
212 inputs: [pasteHTML(`<meta charset='utf-8'><i>Italic</i>`)],
213 name: 'should produce the correct editor state from a pasted HTML i element',
217 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><em class="editor-text-italic" data-lexical-text="true">Italic</em></p></div>',
218 inputs: [pasteHTML(`<meta charset='utf-8'><em>Italic</em>`)],
219 name: 'should produce the correct editor state from a pasted HTML em element',
223 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span class="editor-text-underline" data-lexical-text="true">Underline</span></p></div>',
224 inputs: [pasteHTML(`<meta charset='utf-8'><u>Underline</u>`)],
225 name: 'should produce the correct editor state from a pasted HTML u element',
229 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><h1 class="editor-heading-h1"><span data-lexical-text="true">Lyrics to Hello by Adele</span></h1><p class="editor-paragraph"><span data-lexical-text="true">A thousand times</span></p></div>',
232 `<meta charset='utf-8'><h1>Lyrics to Hello by Adele</h1>A thousand times`,
235 name: 'should produce the correct editor state from pasted heading node followed by a DOM Text Node',
239 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><a href="https://facebook.com"><span data-lexical-text="true">Facebook</span></a></p></div>',
242 `<meta charset='utf-8'><a href="https://facebook.com">Facebook</a>`,
245 name: 'should produce the correct editor state from a pasted HTML anchor element',
249 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">Welcome to</span><a href="https://facebook.com"><span data-lexical-text="true">Facebook!</span></a></p></div>',
252 `<meta charset='utf-8'>Welcome to<a href="https://facebook.com">Facebook!</a>`,
255 name: 'should produce the correct editor state from a pasted combination of an HTML text node followed by an anchor node',
259 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">Welcome to</span><a href="https://facebook.com"><span data-lexical-text="true">Facebook!</span></a><span data-lexical-text="true">We hope you like it here.</span></p></div>',
262 `<meta charset='utf-8'>Welcome to<a href="https://facebook.com">Facebook!</a>We hope you like it here.`,
265 name: 'should produce the correct editor state from a pasted combination of HTML anchor elements and text nodes',
269 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><ul class="editor-list-ul"><li value="1" class="editor-listitem"><span data-lexical-text="true">Hello</span></li><li value="2" class="editor-listitem"><span data-lexical-text="true">from the other</span></li><li value="3" class="editor-listitem"><span data-lexical-text="true">side</span></li></ul></div>',
272 `<meta charset='utf-8'><doesnotexist><ul><li>Hello</li><li>from the other</li><li>side</li></ul></doesnotexist>`,
275 name: 'should ignore DOM node types that do not have transformers, but still process their children.',
279 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><ul class="editor-list-ul"><li value="1" class="editor-listitem"><span data-lexical-text="true">Hello</span></li><li value="2" class="editor-listitem"><span data-lexical-text="true">from the other</span></li><li value="3" class="editor-listitem"><span data-lexical-text="true">side</span></li></ul></div>',
282 `<meta charset='utf-8'><doesnotexist><doesnotexist><ul><li>Hello</li><li>from the other</li><li>side</li></ul></doesnotexist></doesnotexist>`,
285 name: 'should ignore multiple levels of DOM node types that do not have transformers, but still process their children.',
289 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">Welcome to</span><a href="https://facebook.com"><strong class="editor-text-bold" data-lexical-text="true">Facebook!</strong></a><span data-lexical-text="true">We hope you like it here.</span></p></div>',
292 `<meta charset='utf-8'>Welcome to<b><a href="https://facebook.com">Facebook!</a></b>We hope you like it here.`,
295 name: 'should preserve formatting from HTML tags on deeply nested text nodes.',
299 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">Welcome to</span><a href="https://facebook.com"><strong class="editor-text-bold" data-lexical-text="true">Facebook!</strong></a><strong class="editor-text-bold" data-lexical-text="true">We hope you like it here.</strong></p></div>',
302 `<meta charset='utf-8'>Welcome to<b><a href="https://facebook.com">Facebook!</a>We hope you like it here.</b>`,
305 name: 'should preserve formatting from HTML tags on deeply nested and top level text nodes.',
309 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span data-lexical-text="true">Welcome to</span><a href="https://facebook.com"><strong class="editor-text-bold editor-text-italic" data-lexical-text="true">Facebook!</strong></a><strong class="editor-text-bold editor-text-italic" data-lexical-text="true">We hope you like it here.</strong></p></div>',
312 `<meta charset='utf-8'>Welcome to<b><i><a href="https://facebook.com">Facebook!</a>We hope you like it here.</i></b>`,
315 name: 'should preserve multiple types of formatting on deeply nested text nodes and top level text nodes',
319 suite.forEach((testUnit, i) => {
320 const name = testUnit.name || 'Test case';
322 test(name + ` (#${i + 1})`, async () => {
323 await applySelectionInputs(testUnit.inputs, update, editor!);
325 // Validate HTML matches
326 expect(container!.innerHTML).toBe(testUnit.expectedHTML);
331 describe('Google Docs', () => {
335 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span style="color: rgb(0, 0, 0);" data-lexical-text="true">Get schwifty!</span></p></div>',
338 `<b style="font-weight:normal;" id="docs-internal-guid-2c706577-7fff-f54a-fe65-12f480020fac"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Get schwifty!</span></b>`,
341 name: 'should produce the correct editor state from Normal text',
345 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><strong class="editor-text-bold" style="color: rgb(0, 0, 0);" data-lexical-text="true">Get schwifty!</strong></p></div>',
348 `<b style="font-weight:normal;" id="docs-internal-guid-9db03964-7fff-c26c-8b1e-9484fb3b54a4"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Get schwifty!</span></b>`,
351 name: 'should produce the correct editor state from bold text',
355 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><em class="editor-text-italic" style="color: rgb(0, 0, 0);" data-lexical-text="true">Get schwifty!</em></p></div>',
358 `<b style="font-weight:normal;" id="docs-internal-guid-9db03964-7fff-c26c-8b1e-9484fb3b54a4"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:italic;font-variant:normal;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Get schwifty!</span></b>`,
361 name: 'should produce the correct editor state from italic text',
365 '<div contenteditable="true" style="user-select: text; white-space: pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><span class="editor-text-strikethrough" style="color: rgb(0, 0, 0);" data-lexical-text="true">Get schwifty!</span></p></div>',
368 `<b style="font-weight:normal;" id="docs-internal-guid-9db03964-7fff-c26c-8b1e-9484fb3b54a4"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:line-through;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Get schwifty!</span></b>`,
371 name: 'should produce the correct editor state from strikethrough text',
375 suite.forEach((testUnit, i) => {
376 const name = testUnit.name || 'Test case';
378 test(name + ` (#${i + 1})`, async () => {
379 await applySelectionInputs(testUnit.inputs, update, editor!);
381 // Validate HTML matches
382 expect(container!.innerHTML).toBe(testUnit.expectedHTML);
387 describe('W3 spacing', () => {
391 '<p class="editor-paragraph"><span data-lexical-text="true">hello world</span></p>',
392 inputs: [pasteHTML('<span>hello world</span>')],
393 name: 'inline hello world',
397 '<p class="editor-paragraph"><span data-lexical-text="true">hello world</span></p>',
398 inputs: [pasteHTML('<span> hello </span>world ')],
399 name: 'inline hello world (2)',
402 // MS Office got it right
404 '<p class="editor-paragraph"><span data-lexical-text="true"> hello world</span></p>',
406 pasteHTML(' <span style="white-space: pre"> hello </span> world '),
408 name: 'pre + inline (inline collapses with pre)',
412 '<p class="editor-paragraph"><span data-lexical-text="true"> a b</span><span data-lexical-text="true">\t</span><span data-lexical-text="true">c </span></p>',
413 inputs: [pasteHTML('<p style="white-space: pre"> a b\tc </p>')],
414 name: 'white-space: pre (1) (no touchy)',
418 '<p class="editor-paragraph"><span data-lexical-text="true">a b c</span></p>',
419 inputs: [pasteHTML('<p>\ta\tb <span>c\t</span>\t</p>')],
420 name: 'tabs are collapsed',
424 '<p class="editor-paragraph"><span data-lexical-text="true">hello world</span></p>',
433 name: 'remove beginning + end spaces on the block',
437 '<p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">hello world</strong></p>',
448 name: 'remove beginning + end spaces on the block (2)',
452 '<p class="editor-paragraph"><span data-lexical-text="true">a </span><strong class="editor-text-bold" data-lexical-text="true">b</strong><span data-lexical-text="true"> c</span></p>',
462 name: 'remove beginning + end spaces on the block + anonymous inlines collapsible rules',
466 '<p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">a </strong><span data-lexical-text="true">b</span></p>',
467 inputs: [pasteHTML('<div><strong>a </strong>b</div>')],
468 name: 'collapsibles and neighbors (1)',
472 '<p class="editor-paragraph"><span data-lexical-text="true">a</span><strong class="editor-text-bold" data-lexical-text="true"> b</strong></p>',
473 inputs: [pasteHTML('<div>a<strong> b</strong></div>')],
474 name: 'collapsibles and neighbors (2)',
478 '<p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">a </strong><span data-lexical-text="true">b</span></p>',
479 inputs: [pasteHTML('<div><strong>a </strong><span></span>b</div>')],
480 name: 'collapsibles and neighbors (3)',
484 '<p class="editor-paragraph"><span data-lexical-text="true">a</span><strong class="editor-text-bold" data-lexical-text="true"> b</strong></p>',
485 inputs: [pasteHTML('<div>a<span></span><strong> b</strong></div>')],
486 name: 'collapsibles and neighbors (4)',
489 expectedHTML: '<p class="editor-paragraph"><br></p>',
500 '<p class="editor-paragraph"><span data-lexical-text="true">a</span></p>',
501 inputs: [pasteHTML('<span> </span><span>a</span>')],
502 name: 'redundant inline at start',
506 '<p class="editor-paragraph"><span data-lexical-text="true">a</span></p>',
507 inputs: [pasteHTML('<span>a</span><span> </span>')],
508 name: 'redundant inline at end',
512 '<p class="editor-paragraph"><span data-lexical-text="true">a</span></p><p class="editor-paragraph"><span data-lexical-text="true">b</span></p>',
525 name: 'collapsible spaces with nested structures',
529 '<p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">a b</strong></p>',
542 name: 'collapsible spaces with nested structures (3)',
546 '<p class="editor-paragraph"><span data-lexical-text="true">a</span><br><span data-lexical-text="true">b</span></p>',
556 name: 'forced line break should remain',
560 '<p class="editor-paragraph"><span data-lexical-text="true">a</span><br><span data-lexical-text="true">b</span></p>',
570 name: 'forced line break with tabs',
574 '<p class="editor-paragraph"><span data-lexical-text="true">paragraph1</span></p><p class="editor-paragraph"><span data-lexical-text="true">paragraph2</span></p>',
577 '\n<p class="p1">paragraph1</p>\n<p class="p1">paragraph2</p>\n',
580 name: 'two Apple Notes paragraphs',
584 '<p class="editor-paragraph"><span data-lexical-text="true">line 1</span><br><span data-lexical-text="true">line 2</span></p><p class="editor-paragraph"><br></p><p class="editor-paragraph"><span data-lexical-text="true">paragraph 1</span></p><p class="editor-paragraph"><span data-lexical-text="true">paragraph 2</span></p>',
587 '\n<p class="p1">line 1<br>\nline 2</p>\n<p class="p2"><br></p>\n<p class="p1">paragraph 1</p>\n<p class="p1">paragraph 2</p>\n',
590 name: 'two Apple Notes lines + two paragraphs separated by an empty paragraph',
594 '<p class="editor-paragraph"><span data-lexical-text="true">line 1</span><br><span data-lexical-text="true">line 2</span></p><p class="editor-paragraph"><br></p><p class="editor-paragraph"><span data-lexical-text="true">paragraph 1</span></p><p class="editor-paragraph"><span data-lexical-text="true">paragraph 2</span></p>',
597 '\n<p class="p1">line 1<br>\nline 2</p>\n<p class="p2">\n<br>\n</p>\n<p class="p1">paragraph 1</p>\n<p class="p1">paragraph 2</p>\n',
600 name: 'two lines + two paragraphs separated by an empty paragraph (2)',
604 '<p class="editor-paragraph"><span data-lexical-text="true">line 1</span><br><span data-lexical-text="true">line 2</span></p>',
607 '<p class="p1"><span>line 1</span><span><br></span><span>line 2</span></p>',
610 name: 'two lines and br in spans',
614 '<ol class="editor-list-ol"><li value="1" class="editor-listitem"><span data-lexical-text="true">1</span><br><span data-lexical-text="true">2</span></li><li value="2" class="editor-listitem"><br></li><li value="3" class="editor-listitem"><span data-lexical-text="true">3</span></li></ol>',
616 pasteHTML('<ol><li>1<div></div>2</li><li></li><li>3</li></ol>'),
618 name: 'empty block node in li behaves like a line break',
622 '<p class="editor-paragraph"><span data-lexical-text="true">1</span><br><span data-lexical-text="true">2</span></p>',
623 inputs: [pasteHTML('<div>1<div></div>2</div>')],
624 name: 'empty block node in div behaves like a line break',
628 '<p class="editor-paragraph"><span data-lexical-text="true">12</span></p>',
629 inputs: [pasteHTML('<div>1<text></text>2</div>')],
630 name: 'empty inline node does not behave like a line break',
634 '<p class="editor-paragraph"><span data-lexical-text="true">1</span></p><p class="editor-paragraph"><span data-lexical-text="true">2</span></p>',
635 inputs: [pasteHTML('<div><div>1</div><div></div><div>2</div></div>')],
636 name: 'empty block node between non inline siblings does not behave like a line break',
640 '<p class="editor-paragraph"><span data-lexical-text="true">a</span></p><p class="editor-paragraph"><span data-lexical-text="true">b b</span></p><p class="editor-paragraph"><span data-lexical-text="true">c</span></p><p class="editor-paragraph"><span data-lexical-text="true">z</span></p><p class="editor-paragraph"><span data-lexical-text="true">d e</span></p><p class="editor-paragraph"><span data-lexical-text="true">fg</span></p>',
643 `<div>a<div>b b<div>c<div><div></div>z</div></div>d e</div>fg</div>`,
650 '<ol class="editor-list-ol"><li value="1" class="editor-listitem"><span data-lexical-text="true">1</span></li><li value="2" class="editor-listitem"><br></li><li value="3" class="editor-listitem"><span data-lexical-text="true">3</span></li></ol>',
651 inputs: [pasteHTML('<ol><li>1</li><li><br /></li><li>3</li></ol>')],
652 name: 'only br in a li',
656 '<p class="editor-paragraph"><span data-lexical-text="true">1</span></p><p class="editor-paragraph"><span data-lexical-text="true">2</span></p><p class="editor-paragraph"><span data-lexical-text="true">3</span></p>',
657 inputs: [pasteHTML('1<p>2<br /></p>3')],
658 name: 'last br in a block node is ignored',
662 suite.forEach((testUnit, i) => {
663 const name = testUnit.name || 'Test case';
665 // eslint-disable-next-line no-only-tests/no-only-tests, dot-notation
666 const test_ = 'only' in testUnit && testUnit['only'] ? test.only : test;
667 test_(name + ` (#${i + 1})`, async () => {
668 await applySelectionInputs(testUnit.inputs, update, editor!);
670 // Validate HTML matches
671 expect((container!.firstChild as HTMLElement).innerHTML).toBe(
672 testUnit.expectedHTML,