import * as React from 'react';
import { Table } from '../index';
import render from '../../utils/_tests/render';
describe('props', () => {
it('should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with CSS props', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with dividers', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with stripes', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with hoverable rows', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with for a responsive table', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with for a responsive table with breakpoint', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with for a table with minimal variant', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('should render correctly with for a table with shadowed variant', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('overrides', () => {
it('Table.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Head.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.HeadCell.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Body.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Cell.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Foot.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Row.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('theming', () => {
it('Table.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{
theme: { Table: { styles: { base: { backgroundColor: 'red' } } } },
}
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Head.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { Head: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.HeadCell.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { HeadCell: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Body.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { Body: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Cell.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { Cell: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Row.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { Row: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
it('Table.Foot.base should render correctly', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{ theme: { Table: { Foot: { styles: { base: { backgroundColor: 'red' } } } } } }
);
expect(container.firstChild).toMatchSnapshot();
});
});
describe('defaultProps', () => {
it('should render correctly for className', () => {
const { container } = render(
Name
Quantity
Price
Nike
3
$9.00
Adidas
4
$12.00
North Face
5
$15.00
Total
$36.00
,
{
// @ts-ignore
theme: { Table: { defaultProps: { className: 'test', color: 'primary' } } },
}
);
expect(container.firstChild).toMatchSnapshot();
});
});