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.
9 import {$createTableRowNode} from '@lexical/table';
10 import {initializeUnitTest} from 'lexical/__tests__/utils';
12 const editorConfig = Object.freeze({
15 tableRow: 'test-table-row-class',
19 describe('LexicalTableRowNode tests', () => {
20 initializeUnitTest((testEnv) => {
21 test('TableRowNode.constructor', async () => {
22 const {editor} = testEnv;
24 await editor.update(() => {
25 const rowNode = $createTableRowNode();
27 expect(rowNode).not.toBe(null);
30 expect(() => $createTableRowNode()).toThrow();
33 test('TableRowNode.createDOM()', async () => {
34 const {editor} = testEnv;
36 await editor.update(() => {
37 const rowNode = $createTableRowNode();
38 expect(rowNode.createDOM(editorConfig).outerHTML).toBe(
39 `<tr class="${editorConfig.theme.tableRow}"></tr>`,
43 const rowWithCustomHeightNode = $createTableRowNode(36);
44 expect(rowWithCustomHeightNode.createDOM(editorConfig).outerHTML).toBe(
45 `<tr style="height: ${rowHeight}px;" class="${editorConfig.theme.tableRow}"></tr>`,