mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* feat: add columns layout to grouped grid views * test: strengthen Columns layout coverage * fix: remove doubled vertical border on group column spans The group-by divider already draws a full-height line at each level boundary, so the span's own border-right rendered a second adjacent line in the body but not in the header. * chore: renumber group_by_layout migration after rebase Develop added 0221 and 0222 in the meantime, so the branch migration forked the graph into two leaf nodes. * refactor: rename banner group layout to section
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
import { fitGroupByWidths } from '@baserow/modules/database/utils/gridGroupByWidths'
|
|
|
|
describe('fitGroupByWidths', () => {
|
|
test('keeps configured widths when they fit or the grid is not measured', () => {
|
|
const groupBys = [{ width: 90 }, { width: 180 }, { width: 270 }]
|
|
|
|
expect(fitGroupByWidths(groupBys, 600, 78)).toEqual([90, 180, 270])
|
|
expect(fitGroupByWidths(groupBys, null, 78)).toEqual([90, 180, 270])
|
|
})
|
|
|
|
test('scales only space above the minimum and does not mutate configured widths', () => {
|
|
const groupBys = [
|
|
{ width: 78 },
|
|
{ width: 120 },
|
|
{ width: 200 },
|
|
{ width: 260 },
|
|
{ width: 342 },
|
|
]
|
|
const configuredWidths = groupBys.map(({ width }) => width)
|
|
const renderedWidths = fitGroupByWidths(groupBys, 652, 78)
|
|
|
|
expect(renderedWidths[0]).toBe(78)
|
|
expect(renderedWidths.every((width) => width >= 78)).toBe(true)
|
|
expect(
|
|
renderedWidths.reduce((total, width) => total + width, 0)
|
|
).toBeCloseTo(652)
|
|
expect(groupBys.map(({ width }) => width)).toEqual(configuredWidths)
|
|
})
|
|
})
|