Files
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

58 lines
1.7 KiB
TypeScript

import { describe, expect, test } from 'bun:test';
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { CompactEditControls } from './CompactEditControls';
describe('CompactEditControls', () => {
test('keeps source-file Save and Cancel in a normal-flow touch row', () => {
const html = renderToStaticMarkup(
<CompactEditControls
documentTitle="notes.md"
sourceBacked
saveStatus="dirty"
cancelMode
confirmDiscard={false}
onSave={() => {}}
onExit={() => {}}
/>,
);
expect(html).toContain('data-pn-compact-edit-controls="true"');
expect(html).toContain('Editing notes.md');
expect(html).toContain('>Save<');
expect(html).toContain('>Cancel<');
expect(html.match(/data-pn-touch-target/g)).toHaveLength(2);
expect(html).not.toContain('fixed');
expect(html).not.toContain('sticky');
});
test('uses Done for plan edits and a clear second-step discard label', () => {
const plan = renderToStaticMarkup(
<CompactEditControls
documentTitle="Plan"
sourceBacked={false}
saveStatus={undefined}
cancelMode={false}
confirmDiscard={false}
onSave={() => {}}
onExit={() => {}}
/>,
);
const discard = renderToStaticMarkup(
<CompactEditControls
documentTitle="notes.md"
sourceBacked
saveStatus="dirty"
cancelMode
confirmDiscard
onSave={() => {}}
onExit={() => {}}
/>,
);
expect(plan).toContain('>Done<');
expect(plan).not.toContain('>Save<');
expect(discard).toContain('>Discard changes<');
});
});