mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
27791a6fba
* 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
45 lines
1.7 KiB
TypeScript
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'));
|
|
});
|
|
});
|