From 5cb449e468e2139a7e5c135c111a756567b5782a Mon Sep 17 00:00:00 2001 From: Ivaylo Pavlov Date: Tue, 27 Aug 2024 11:52:39 +0300 Subject: [PATCH] add back row striping test --- .../__tests__/unit/LexicalTableNode.test.tsx | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx b/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx index 74fc3eb3191..161def23622 100644 --- a/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx +++ b/packages/lexical-table/src/__tests__/unit/LexicalTableNode.test.tsx @@ -345,6 +345,47 @@ describe('LexicalTableNode tests', () => { } }); }); + + test('Toggle row striping ON/OFF', async () => { + const {editor} = testEnv; + + await editor.update(() => { + const root = $getRoot(); + const table = $createTableNodeWithDimensions(4, 4, true); + root.append(table); + }); + await editor.update(() => { + const root = $getRoot(); + const table = root.getLastChild(); + if (table) { + table.setRowStriping(true); + } + }); + + await editor.update(() => { + const root = $getRoot(); + const table = root.getLastChild(); + expect(table!.createDOM(editorConfig).outerHTML).toBe( + `
`, + ); + }); + + await editor.update(() => { + const root = $getRoot(); + const table = root.getLastChild(); + if (table) { + table.setRowStriping(false); + } + }); + + await editor.update(() => { + const root = $getRoot(); + const table = root.getLastChild(); + expect(table!.createDOM(editorConfig).outerHTML).toBe( + `
`, + ); + }); + }); }, undefined, ,