UNPKG

@retailmenot/anchor

Version:

A React UI Library by RetailMeNot

52 lines 2.6 kB
// VENDOR import * as React from 'react'; import * as renderer from 'react-test-renderer'; import { ThemeProvider } from '@xstyled/styled-components'; import { shallow, mount } from 'enzyme'; // ANCHOR import { RootTheme } from '../../src/theme'; import { Table } from './Table.component'; const { Head, Body, Cell, Footer, Row, HeaderCell } = Table; describe('Component: Table', () => { const table = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Table, null))); const wrapper = mount(table); const component = shallow(table); expect(table).toBeDefined(); expect(wrapper).toBeDefined(); expect(component).toBeDefined(); it('should match snapshot.', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Table, null))); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); it('should render with all the bells and whistles', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Table, null, React.createElement(Head, null, React.createElement(Row, null, React.createElement(HeaderCell, null, "Fruit"), React.createElement(HeaderCell, null, "Color"), React.createElement(HeaderCell, null, "Calories"))), React.createElement(Body, null, React.createElement(Row, null, React.createElement(Cell, null, "Apple"), React.createElement(Cell, null, "Red"), React.createElement(Cell, null, "95")), React.createElement(Row, null, React.createElement(Cell, null, "Banana"), React.createElement(Cell, null, "Yellow"), React.createElement(Cell, null, "105")), React.createElement(Row, null, React.createElement(Cell, null, "Cranberry"), React.createElement(Cell, null, "Red"), React.createElement(Cell, null, "2"))), React.createElement(Footer, null, React.createElement(Row, null, React.createElement(Cell, null, "People use tfoots?")))))); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); }); //# sourceMappingURL=Table.component.spec.js.map