40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
REQUIREMENT_TABLE_BADGE_CLASS,
|
|
REQUIREMENT_TABLE_CLASS,
|
|
REQUIREMENT_TABLE_COLUMN_WIDTHS,
|
|
REQUIREMENT_TABLE_CONTAINER_CLASS,
|
|
REQUIREMENT_TABLE_HEADER_CELL_CLASS,
|
|
getRequirementTableTextClass,
|
|
} from './requirement-table-layout';
|
|
|
|
test('uses fixed table layout without horizontal scrolling for requirement list', () => {
|
|
assert.match(REQUIREMENT_TABLE_CLASS, /\btable-fixed\b/);
|
|
assert.doesNotMatch(REQUIREMENT_TABLE_CLASS, /\bmin-w-\[/);
|
|
assert.doesNotMatch(REQUIREMENT_TABLE_CONTAINER_CLASS, /\boverflow-x-auto\b/);
|
|
|
|
const totalWidth = REQUIREMENT_TABLE_COLUMN_WIDTHS.reduce((sum, width) => sum + width, 0);
|
|
assert.equal(totalWidth, 100);
|
|
});
|
|
|
|
test('keeps requirement table headers on one line', () => {
|
|
assert.match(REQUIREMENT_TABLE_HEADER_CELL_CLASS, /\bwhitespace-nowrap\b/);
|
|
});
|
|
|
|
test('keeps requirement table badges on one line', () => {
|
|
assert.match(REQUIREMENT_TABLE_BADGE_CLASS, /\bwhitespace-nowrap\b/);
|
|
assert.match(REQUIREMENT_TABLE_BADGE_CLASS, /\bshrink-0\b/);
|
|
});
|
|
|
|
test('clips long requirement source project type version and creator cells', () => {
|
|
for (const column of ['source', 'project', 'type', 'version', 'creator'] as const) {
|
|
const className = getRequirementTableTextClass(column);
|
|
|
|
assert.match(className, /\btruncate\b/);
|
|
assert.match(className, /\bblock\b/);
|
|
assert.match(className, /\bmax-w-\[/);
|
|
}
|
|
});
|