feat(ui): add A1 dashboard and resumable onboarding
This commit is contained in:
@@ -31,13 +31,23 @@ test('schema two preserves chosen hidden geometry without resetting the owner re
|
||||
|
||||
test('default catalogue preserves every section and supported widths', () => {
|
||||
const layout = defaultDashboardLayout();
|
||||
expect(layout.widgets.map(w => w.id)).toEqual(['cards', 'attention', 'funnel', 'activity', 'stageAge', 'sources', 'salary', 'companies', 'skills']);
|
||||
expect(new Set(layout.widgets.map(w => w.id))).toEqual(new Set(WIDGETS.map(w => w.id)));
|
||||
expect(layout.widgets.every(w => w.visible)).toBe(true);
|
||||
expect(WIDGETS[0].sizes).toEqual(['full']);
|
||||
layout.widgets[0].visible = false;
|
||||
expect(defaultDashboardLayout().widgets[0].visible).toBe(true);
|
||||
});
|
||||
|
||||
test.each([1, 2])('new schema %s preferences use task-first A1 defaults without omitting widgets', version => {
|
||||
const layout = normalizeDashboardLayout({ version, revision: 0, widgets: [] });
|
||||
expect(layout.widgets[0]).toMatchObject({ id: 'attention', visible: true, x: 0, y: 0, w: 12 });
|
||||
expect(layout.widgets.findIndex(widget => widget.id === 'cards')).toBeGreaterThan(layout.widgets.findIndex(widget => widget.id === 'funnel'));
|
||||
expect(layout.widgets).toHaveLength(WIDGETS.length);
|
||||
const visible = layout.widgets.filter(widget => widget.visible);
|
||||
expect(visible.every(widget => widget.x >= 0 && widget.x + widget.w <= 12 && widget.h <= 24 && widget.y + widget.h <= 256)).toBe(true);
|
||||
expect(visible.some((a, index) => visible.slice(index + 1).some(b => a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y))).toBe(false);
|
||||
});
|
||||
|
||||
test('saved layouts retain known order, reject duplicates and append missing sections hidden', () => {
|
||||
const result = normalizeDashboardLayout({ version: 1, revision: 7, widgets: [
|
||||
{ id: 'skills', visible: false, size: 'full' },
|
||||
@@ -49,7 +59,7 @@ test('saved layouts retain known order, reject duplicates and append missing sec
|
||||
expect(result.widgets[0]).toMatchObject({ id: 'skills', visible: false, size: 'full' });
|
||||
expect(result.widgets[1]).toMatchObject({ id: 'cards', visible: false, size: 'full' });
|
||||
expect(result.widgets.slice(2).every(w => !w.visible)).toBe(true);
|
||||
expect(result.widgets).toHaveLength(9);
|
||||
expect(result.widgets).toHaveLength(WIDGETS.length);
|
||||
});
|
||||
|
||||
test.each([null, {}, { version: 3, revision: 8, widgets: [] }, { version: 1, revision: -1, widgets: [] }])('invalid input has safe defaults: %j', input => {
|
||||
|
||||
Reference in New Issue
Block a user