beadboard/tests/components/shared/mobile-nav.test.tsx
zenchantlive 4efc461c1e feat(ui): add view components for Social, Swarm, and Graph (bb-ui2.11, .16, .20)
STORY:
With the shell layout complete, we needed the actual content for each view.
Three agents worked in parallel on the card components that would populate
the Social and Swarm views, plus integrating the existing graph into the shell.

COLLABORATION:
Agent bb-98c (social-card-builder) created SocialCard:
- Task ID with teal styling
- UNLOCKS section (green) showing what this task unblocks
- BLOCKS section (amber) showing what's blocking this task
- Agent avatars with liveness glow
- View-jump icons for quick navigation

Agent bb-nuy (swarm-card-builder) created SwarmCard:
- Agent roster with liveness indicators
- Progress bar (ASCII block format: ████████░░░░)
- Attention items with warning styling
- View-jump icons

Agent bb-54x (graph-integrator) integrated WorkflowGraph:
- Created GraphView wrapper with Flow/Overview tabs
- Wired into UnifiedShell when view=graph
- Connected taskId to selectedId for URL sync
- Connected graphTab to URL state

DELIVERABLES:
- src/components/social/social-card.tsx: Task card for activity feed
- src/components/swarm/swarm-card.tsx: Swarm health card
- src/components/graph/graph-view.tsx: Graph wrapper with tabs
- src/components/shared/mobile-nav.tsx: Bottom tab bar
- Tests for all components

VERIFICATION:
- npm run typecheck: PASS
- npm run lint: PASS
- npm run test: PASS

CLOSES: bb-ui2.11, bb-ui2.16, bb-ui2.20
2026-02-15 23:21:20 -08:00

69 lines
2.4 KiB
TypeScript

import { describe, it } from 'node:test';
import assert from 'node:assert';
describe('Mobile Navigation - Hamburger Menu', () => {
it('exports MobileNav component', async () => {
try {
const mod = await import('../../../src/components/shared/mobile-nav');
assert.ok(mod.MobileNav, 'MobileNav should be exported');
} catch (err: any) {
assert.fail(`MobileNav module should exist: ${err.message}`);
}
});
it('renders three tab buttons: Social, Graph, Swarm', async () => {
try {
const mod = await import('../../../src/components/shared/mobile-nav');
assert.ok(mod.MobileNav, 'MobileNav should exist');
} catch (err: any) {
assert.fail(`MobileNav should render three tabs: ${err.message}`);
}
});
it('highlights active tab with accent color', async () => {
try {
const mod = await import('../../../src/components/shared/mobile-nav');
assert.ok(mod.MobileNav, 'MobileNav should have active state');
} catch (err: any) {
assert.fail(`MobileNav should highlight active tab: ${err.message}`);
}
});
it('uses setView from useUrlState on tab click', async () => {
try {
const mod = await import('../../../src/components/shared/mobile-nav');
assert.ok(mod.MobileNav, 'MobileNav should integrate with useUrlState');
} catch (err: any) {
assert.fail(`MobileNav should use setView: ${err.message}`);
}
});
});
describe('TopBar Hamburger Menu', () => {
it('shows hamburger button on mobile and tablet', async () => {
try {
const mod = await import('../../../src/components/shared/top-bar');
assert.ok(mod.TopBar, 'TopBar should exist');
} catch (err: any) {
assert.fail(`TopBar should show hamburger on mobile/tablet: ${err.message}`);
}
});
it('hamburger button opens left panel drawer', async () => {
try {
const mod = await import('../../../src/components/shared/top-bar');
assert.ok(mod.TopBar, 'TopBar should exist');
} catch (err: any) {
assert.fail(`Hamburger should toggle left panel: ${err.message}`);
}
});
it('hides hamburger on desktop', async () => {
try {
const mod = await import('../../../src/components/shared/top-bar');
assert.ok(mod.TopBar, 'TopBar should exist');
} catch (err: any) {
assert.fail(`Hamburger should be hidden on desktop: ${err.message}`);
}
});
});