刘光辉
11 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { describe, expect, it } from 'vitest';
 
import { getColumnActionWidth, resolveColumnActionGroups } from '../helpers/tableActions';
 
describe('resolveColumnActionGroups', () => {
  it('keeps custom row buttons inline instead of moving them into more actions', () => {
    const columnButtons = [{ label: '编辑', value: 'edit' }];
    const customColumnButtons = [
      { event: { position: 1 }, label: '打印', value: 'print' },
      { event: { position: 3 }, label: '发起流程', value: 'launchFlow' },
    ];
 
    const groups = resolveColumnActionGroups(columnButtons, customColumnButtons);
 
    expect(groups.inlineButtons).toEqual([...columnButtons, ...customColumnButtons]);
    expect(groups.moreButtons).toEqual([]);
  });
 
  it('calculates action column width from all inline buttons', () => {
    expect(getColumnActionWidth(1, 2)).toBe(170);
  });
});