Skip to content

Commit

Permalink
add back row striping test
Browse files Browse the repository at this point in the history
  • Loading branch information
ivailop7 committed Aug 27, 2024
1 parent 7fae5d3 commit 5cb449e
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<TableNode>();
if (table) {
table.setRowStriping(true);
}
});

await editor.update(() => {
const root = $getRoot();
const table = root.getLastChild<TableNode>();
expect(table!.createDOM(editorConfig).outerHTML).toBe(
`<table class="${editorConfig.theme.table} ${editorConfig.theme.tableRowStriping}" data-lexical-row-striping="true"></table>`,
);
});

await editor.update(() => {
const root = $getRoot();
const table = root.getLastChild<TableNode>();
if (table) {
table.setRowStriping(false);
}
});

await editor.update(() => {
const root = $getRoot();
const table = root.getLastChild<TableNode>();
expect(table!.createDOM(editorConfig).outerHTML).toBe(
`<table class="${editorConfig.theme.table}"></table>`,
);
});
});
},
undefined,
<TablePlugin />,
Expand Down

0 comments on commit 5cb449e

Please sign in to comment.