Files
backnotprop__plannotator/packages/editor/components/CompactPlanReview.test.tsx
Michael Ramos 27791a6fba Mobile Phase 2B: Plan shell and navigation (#1303)
* feat(editor): add compact plan navigator

* feat(editor): simplify compact plan chrome

* fix(editor): close compact navigator after file selection

* feat(editor): add compact plan review surfaces

* fix(editor): hold navigator through cold file loads

* fix(editor): preserve desktop diff activation
2026-08-13 09:38:14 -07:00

45 lines
1.7 KiB
TypeScript

import { describe, expect, test } from 'bun:test';
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { CompactPlanCompletion, CompactPlanReview } from './CompactPlanReview';
describe('compact Plan completion', () => {
test('keeps the handoff in document flow with one explicit review action', () => {
const html = renderToStaticMarkup(
<CompactPlanCompletion
feedbackSummary="Two annotations are ready."
maxWidth={832}
onOpenReview={() => {}}
/>,
);
expect(html).toContain('data-pn-compact-plan-completion="true"');
expect(html).toContain('Ready to finish?');
expect(html).toContain('Review and finish');
expect(html).toContain('pn-compact-plan-review-trigger');
expect(html).toContain('--pn-safe-bottom');
});
test('promotes one incumbent decision without duplicating decision logic', () => {
const html = renderToStaticMarkup(
<CompactPlanReview
feedbackSummary="One annotation is ready."
actions={[
{ id: 'exit', label: 'Close session', onSelect: () => {} },
{ id: 'feedback', label: 'Send feedback', onSelect: () => {} },
{ id: 'approve', label: 'Approve', onSelect: () => {} },
]}
primaryActionId="feedback"
onOpenAnnotations={() => {}}
/>,
);
expect(html).toContain('Review annotations');
expect(html).toContain('data-pn-compact-review-action="feedback"');
expect(html).toContain('bg-primary text-primary-foreground');
expect(html.indexOf('Send feedback')).toBeLessThan(html.indexOf('Approve'));
expect(html.indexOf('Approve')).toBeLessThan(html.indexOf('Close session'));
});
});