taskKanbanBoard.test.ts2.1 KBView on GitHub import { keepsEmptyColumn } from '@/modules/userTasks/components/TaskKanbanBoard';
/**
* Empty board columns collapse into the "Hidden columns" rail — on every axis, group included.
*
* Group lanes were once exempted wholesale, because a group the user had just created necessarily
* has zero tasks and collapsing it made "Add column" look like it had silently failed. But the
* board columns BY GROUP by default, so exempting all of them retired the rail in practice: every
* empty lane stayed on the board and "Hidden columns" never appeared.
*
* The exemption is now exactly the lane that motivated it — the one just created from this board,
* passed in by id. This pins that shape.
*/
describe('keepsEmptyColumn', () => {
const JUST_CREATED = 'group-created-a-second-ago';
it('keeps the lane just created from the board, so Add column visibly worked', () => {
expect(keepsEmptyColumn('group', JUST_CREATED, JUST_CREATED)).toBe(true);
});
it('collapses every other empty group lane, including one emptied by finishing its last task', () => {
expect(keepsEmptyColumn('group', 'some-other-group', JUST_CREATED)).toBe(false);
});
it('collapses empty group lanes when nothing was just created', () => {
expect(keepsEmptyColumn('group', 'some-group-uuid')).toBe(false);
expect(keepsEmptyColumn('group', 'some-group-uuid', null)).toBe(false);
});
it('collapses empty Misc — in the rail it is still a row you can drop onto', () => {
expect(keepsEmptyColumn('group', '__misc__', JUST_CREATED)).toBe(false);
});
it('collapses Upcoming even if its key somehow matched — it is a time bucket, not a lane', () => {
expect(keepsEmptyColumn('group', '__upcoming__', '__upcoming__')).toBe(false);
});
it('leaves the due and channel boards collapsing as before', () => {
for (const key of ['overdue', 'today', 'week', 'later', 'none']) {
expect(keepsEmptyColumn('due', key, key)).toBe(false);
}
for (const key of ['email', 'slack', 'linkedin', 'whatsapp']) {
expect(keepsEmptyColumn('channel', key, key)).toBe(false);
}
});
});