import { expect } from '@open-wc/testing' import { DataGridField } from '../src/data-grid/data-grid-field.js' import { FilterStyles } from '../src/filters/filter-styles.js' /** * A button inside a grid cell is --cell-action-height (26px by default, ADR-0060 decision 6), for its * width as well: a second token for the width could say a different number. It still takes no more * than a line of text in the row, so one cell with a button does not make every row taller. */ const text = (styles: unknown) => (Array.isArray(styles) ? styles : [styles]).map(s => String((s as { cssText?: string }).cssText ?? s)).join('\n') describe('cell action height', () => { it('the icon button in a cell reads the cell token for height and width', () => { const css = text(DataGridField.styles) const rule = css.slice(css.indexOf(':host > button.icon {')) expect(rule).to.match(/^:host > button\.icon \{[^}]*width: var\(--cell-action-height, 26px\);/) expect(rule).to.match(/^:host > button\.icon \{[^}]*height: var\(--cell-action-height, 26px\);/) expect(rule).to.contain('margin-top: calc((20px - var(--cell-action-height, 26px)) / 2)') }) }) describe('filter bar input height', () => { it('a grid filter bar: the suite small height in the operato products, natural height elsewhere', () => { const css = text(FilterStyles) expect(css).to.match(/box-sizing: border-box;\s*height: var\(--suite-form-element-height-small, auto\);/) }) })