feat(sacred-valley): card factory, registry ordering, view skeleton
Adds the Plan 6 card framework: svCard() chrome factory, pure orderCards() ordering helper with unit tests, three stub card modules (clock/weather/host-perf), and rewrites sacred_valley.js with the two-band layout that mounts ordered cards. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
19
tests/frontend/card_registry.test.js
Normal file
19
tests/frontend/card_registry.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { orderCards } from '../../public/views/cards/registry.js';
|
||||
|
||||
const defs = [{ id: 'clock' }, { id: 'weather' }, { id: 'host-perf' }];
|
||||
|
||||
describe('orderCards', () => {
|
||||
it('uses saved order first, then appends new cards in default order', () => {
|
||||
const out = orderCards(defs, { card_order: ['weather'], hidden: [] });
|
||||
expect(out.map(c => c.id)).toEqual(['weather', 'clock', 'host-perf']);
|
||||
});
|
||||
it('drops hidden cards', () => {
|
||||
const out = orderCards(defs, { card_order: [], hidden: ['clock'] });
|
||||
expect(out.map(c => c.id)).toEqual(['weather', 'host-perf']);
|
||||
});
|
||||
it('ignores stale ids in saved order', () => {
|
||||
const out = orderCards(defs, { card_order: ['gone', 'clock'], hidden: [] });
|
||||
expect(out.map(c => c.id)).toEqual(['clock', 'weather', 'host-perf']);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user