quality / changes (push) Successful in 7s
quality / go (push) Skipped
quality / bird2 (push) Skipped
quality / commitlint (push) Skipped
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 36s
quality / web (push) Successful in 1m4s
CD / quality (push) Successful in 1m49s
CD / publish (push) Successful in 9m35s
Таблицы ResourcePage и FrameDataGrid переведены на раскладку MikrotikManager: сегменты, фильтры и поиск в тулбаре, подложка шапки, ячейки py-3. KPI стали полосой в одном Frame, переключатели разделов — линейными вкладками. Старая оболочка (app-shell, nav-user, монитор, палитра) удалена: её заменил PortalShell. Тесты kit-раскладки обновлены под новый контракт. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
99 lines
3.1 KiB
TypeScript
99 lines
3.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
applyKitActionColumn,
|
|
KIT_ACTION_COLUMN_SIZE,
|
|
kitColumnPinning,
|
|
kitDataGridTableClassNames,
|
|
kitDataGridTableLayout,
|
|
} from './frame-data-grid'
|
|
|
|
describe('kitDataGridTableLayout', () => {
|
|
it('defaults макета: не dense, headerBackground true, width fixed', () => {
|
|
const layout = kitDataGridTableLayout()
|
|
expect(layout.dense).toBe(false)
|
|
expect(layout.headerBackground).toBe(true)
|
|
expect(layout.width).toBe('fixed')
|
|
expect(layout.headerSticky).toBe(false)
|
|
expect('stripped' in layout ? layout.stripped : undefined).toBeUndefined()
|
|
expect(layout.columnsPinnable).toBe(false)
|
|
})
|
|
|
|
it('kit tableClassNames: поля краёв как в MikrotikManager', () => {
|
|
expect(kitDataGridTableClassNames.edgeCell).toBe('first:ps-5 last:pe-4')
|
|
expect(kitDataGridTableClassNames.base).toBe(
|
|
'[&_[data-pinned]]:bg-(--frame-panel-bg)',
|
|
)
|
|
})
|
|
|
|
it('именованные opts: auto + pin', () => {
|
|
const layout = kitDataGridTableLayout({
|
|
width: 'auto',
|
|
columnsPinnable: true,
|
|
})
|
|
expect(layout.width).toBe('auto')
|
|
expect(layout.columnsPinnable).toBe(true)
|
|
expect(layout.headerBackground).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('applyKitActionColumn', () => {
|
|
it('locks filtering-2 size on id=actions', () => {
|
|
const [name, actions] = applyKitActionColumn([
|
|
{ id: 'name', header: 'Name' },
|
|
{ id: 'actions', header: () => null, cell: () => 'x' },
|
|
])
|
|
expect(name?.id).toBe('name')
|
|
expect(actions?.size).toBe(KIT_ACTION_COLUMN_SIZE)
|
|
expect(actions?.minSize).toBe(KIT_ACTION_COLUMN_SIZE)
|
|
expect(actions?.maxSize).toBe(KIT_ACTION_COLUMN_SIZE)
|
|
expect(actions?.enableSorting).toBe(false)
|
|
expect(actions?.enableResizing).toBe(false)
|
|
})
|
|
|
|
it('keeps explicit size (data-grid-base-7 text button)', () => {
|
|
const [actions] = applyKitActionColumn([
|
|
{ id: 'actions', size: 104, cell: () => 'x' },
|
|
])
|
|
expect(actions?.size).toBe(104)
|
|
expect(actions?.minSize).toBe(104)
|
|
expect(actions?.maxSize).toBe(104)
|
|
})
|
|
|
|
it('does not rewrite a non-actions last column', () => {
|
|
const [col] = applyKitActionColumn([{ id: 'name', header: 'Name' }])
|
|
expect(col?.size).toBeUndefined()
|
|
expect(col?.enableResizing).toBeUndefined()
|
|
})
|
|
|
|
it('applies DNA when pinLastColumn even without id=actions', () => {
|
|
const [col] = applyKitActionColumn([{ id: 'other', cell: () => 'x' }], {
|
|
pinLastColumn: true,
|
|
})
|
|
expect(col?.size).toBe(KIT_ACTION_COLUMN_SIZE)
|
|
expect(col?.maxSize).toBe(KIT_ACTION_COLUMN_SIZE)
|
|
})
|
|
})
|
|
|
|
describe('kitColumnPinning', () => {
|
|
it('does not end-pin without horizontalScroll', () => {
|
|
const result = kitColumnPinning({
|
|
pinLastColumn: true,
|
|
lastColId: 'actions',
|
|
})
|
|
expect(result.enablePinning).toBe(false)
|
|
expect(result.columnPinning.end).toEqual([])
|
|
})
|
|
|
|
it('end-pins only with horizontalScroll', () => {
|
|
const result = kitColumnPinning({
|
|
pinLastColumn: true,
|
|
horizontalScroll: true,
|
|
lastColId: 'actions',
|
|
})
|
|
expect(result.enablePinning).toBe(true)
|
|
expect(result.columnPinning.end).toEqual(['actions'])
|
|
})
|
|
})
|
|
|