|
|
|
@@ -0,0 +1,52 @@ |
|
|
|
import { describe, expect, it } from 'vitest' |
|
|
|
import { |
|
|
|
isEditingAvailable, |
|
|
|
isRightPanelCollapsible, |
|
|
|
semanticStatusColors, |
|
|
|
statusDefinitions, |
|
|
|
workspaceDensityProfile, |
|
|
|
workspaceThemeTokens, |
|
|
|
getWorkspaceViewportMode, |
|
|
|
} from './workspaceContracts' |
|
|
|
|
|
|
|
describe('workspace visual foundation contracts', () => { |
|
|
|
it('uses the approved Ant Design token palette and compact density profile', () => { |
|
|
|
expect(workspaceThemeTokens.colorPrimary).toBe('#1F4E79') |
|
|
|
expect(workspaceThemeTokens.colorSuccess).toBe('#2E7D32') |
|
|
|
expect(workspaceThemeTokens.colorWarning).toBe('#B45309') |
|
|
|
expect(workspaceThemeTokens.colorError).toBe('#B91C1C') |
|
|
|
expect(workspaceThemeTokens.colorInfo).toBe('#2563EB') |
|
|
|
expect(semanticStatusColors.secondary).toBe('#0F766E') |
|
|
|
expect(semanticStatusColors.overdue).toBe('#7F1D1D') |
|
|
|
expect(workspaceDensityProfile.compact).toBe(true) |
|
|
|
expect(workspaceDensityProfile.controlHeight).toBeLessThanOrEqual(32) |
|
|
|
}) |
|
|
|
|
|
|
|
it('maps desktop breakpoints to the required layout modes', () => { |
|
|
|
expect(getWorkspaceViewportMode(1279)).toBe('read-reduced') |
|
|
|
expect(getWorkspaceViewportMode(1280)).toBe('compact-tri-pane') |
|
|
|
expect(getWorkspaceViewportMode(1599)).toBe('compact-tri-pane') |
|
|
|
expect(getWorkspaceViewportMode(1600)).toBe('full-tri-pane') |
|
|
|
}) |
|
|
|
|
|
|
|
it('allows editing only at supported desktop widths', () => { |
|
|
|
expect(isEditingAvailable(1024)).toBe(false) |
|
|
|
expect(isEditingAvailable(1279)).toBe(false) |
|
|
|
expect(isEditingAvailable(1280)).toBe(true) |
|
|
|
}) |
|
|
|
|
|
|
|
it('keeps the right panel collapsible only in standard desktop compact mode', () => { |
|
|
|
expect(isRightPanelCollapsible(1279)).toBe(false) |
|
|
|
expect(isRightPanelCollapsible(1280)).toBe(true) |
|
|
|
expect(isRightPanelCollapsible(1599)).toBe(true) |
|
|
|
expect(isRightPanelCollapsible(1600)).toBe(false) |
|
|
|
}) |
|
|
|
|
|
|
|
it('requires every status indicator to have color plus text and icon labels', () => { |
|
|
|
Object.values(statusDefinitions).forEach((status) => { |
|
|
|
expect(status.color).toMatch(/^#[0-9A-F]{6}$/) |
|
|
|
expect(status.label.length).toBeGreaterThan(0) |
|
|
|
expect(status.iconLabel.length).toBeGreaterThan(0) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |