import * as React from 'react'
import renderWithTheme from '../../tests/helpers/renderWithTheme'
import Table from './Table'
describe('component: Table', () => {
test('ignores width on card', () => {
const { getByTestId } = renderWithTheme(
Header Cell
Data cell
Data cell
Data cell
)
const singleCell = getByTestId('cell')
expect(singleCell).toHaveStyle('width: 240px')
})
test('renders mini table styles', () => {
const { getByTestId } = renderWithTheme(
Header Cell
Data cell
Data cell
Data cell
)
const headerCell = getByTestId('header-cell')
const dataCell = getByTestId('data-cell')
expect(headerCell).toHaveStyle('padding: 8px')
expect(dataCell).toHaveStyle('padding: 8px')
})
test('supports margin space props', () => {
const { getByTitle } = renderWithTheme(
)
const tableWrapper = getByTitle('Table Title').parentElement
expect(tableWrapper).toHaveStyle('margin-top: 4px')
expect(tableWrapper).toHaveStyle('margin-bottom: 100px')
expect(tableWrapper).toHaveStyle('margin-left: 40px')
expect(tableWrapper).toHaveStyle('margin-right: 40px')
})
test('Sticky column right', () => {
const { getAllByTestId } = renderWithTheme(
Header Cell
Header Cell
Header Cell
Sticky cell 1
Data cell
Data cell
Data cell
Sticky cell 2
Data cell
Data cell
Data cell
Sticky cell 3
)
getAllByTestId('sticky').forEach((element) => {
expect(element).toHaveStyle('position: sticky')
})
})
})