Skip to content

Commit 9bb09b6

Browse files
committed
add unit tests for new behavior
1 parent 4347b41 commit 9bb09b6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/react-table/src/components/Table/__tests__/Table.test.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,33 @@ test(`Renders with class ${styles.modifiers.plain} when isPlain is true`, () =>
156156

157157
expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.plain);
158158
});
159+
160+
test(`Does not render with class ${styles.modifiers.plain} when isPlain is not defined`, () => {
161+
render(<Table aria-label="Test table" />);
162+
163+
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.plain);
164+
});
165+
166+
test(`Does not render with class ${styles.modifiers.plain} when isPlain is false`, () => {
167+
render(<Table isPlain={false} aria-label="Test table" />);
168+
169+
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.plain);
170+
});
171+
172+
test(`Renders with class ${styles.modifiers.noPlain} when isPlain is false`, () => {
173+
render(<Table isPlain={false} aria-label="Test table" />);
174+
175+
expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.noPlain);
176+
});
177+
178+
test(`Does not render with class ${styles.modifiers.noPlain} when isPlain is not defined`, () => {
179+
render(<Table aria-label="Test table" />);
180+
181+
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.noPlain);
182+
});
183+
184+
test(`Does not render with class ${styles.modifiers.noPlain} when isPlain is true`, () => {
185+
render(<Table isPlain aria-label="Test table" />);
186+
187+
expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.noPlain);
188+
});

0 commit comments

Comments
 (0)