@@ -9,9 +9,11 @@ import { describe, expect, test } from "bun:test";
99
1010import { withTestRenderer } from "./harness" ;
1111import type { PaletteCommand } from "./command-catalog" ;
12+ import { openPermissionsOverlay , openOperatorOverlay } from "./overlays" ;
1213import { createAppShell } from "./shell/index" ;
1314import type { AppShell } from "./shell/internals" ;
14- import { openHelpOverlay } from "./shell/palette" ;
15+ import { isSlashPopupOpen } from "./shell/internals" ;
16+ import { openHelpOverlay , openPalette } from "./shell/palette" ;
1517
1618const CATALOG : readonly PaletteCommand [ ] = [
1719 { id : "model" , label : "/model" } ,
@@ -58,17 +60,43 @@ describe("unclaimed overlay keys reach the prompt", () => {
5860 } ) ;
5961 } ) ;
6062
61- test ( "ephemeral popup symmetry: slash filter typing still reaches the prompt" , async ( ) => {
63+ test ( "palette symmetry: unclaimed printable with a palette open reaches the prompt via the fallthrough " , async ( ) => {
6264 await withShell ( async ( { shell, press } ) => {
63- press ( "/" ) ;
65+ openPalette ( shell , { catalog : CATALOG } ) ;
6466 expect ( shell . overlayKind ) . toBe ( "palette" ) ;
67+ expect ( isSlashPopupOpen ( shell ) ) . toBe ( false ) ;
6568
66- press ( "m " ) ;
67- expect ( shell . prompt . value ) . toBe ( "/m " ) ;
69+ press ( "x " ) ;
70+ expect ( shell . prompt . value ) . toBe ( "x " ) ;
6871 expect ( shell . overlayKind ) . toBe ( "palette" ) ;
6972 } ) ;
7073 } ) ;
7174
75+ test ( "permission gate keeps printable keys: prompt stays empty, gate stays open" , async ( ) => {
76+ await withShell ( async ( { shell, press } ) => {
77+ openPermissionsOverlay ( shell , { items : [ "Allow once" , "Deny" ] } ) ;
78+ expect ( shell . overlayKind ) . toBe ( "permissions" ) ;
79+
80+ press ( "x" ) ;
81+ expect ( shell . prompt . value ) . toBe ( "" ) ;
82+ expect ( shell . overlayKind ) . toBe ( "permissions" ) ;
83+ } ) ;
84+ } ) ;
85+
86+ test ( "operator gate keeps printable keys: prompt stays empty, gate stays open" , async ( ) => {
87+ await withShell ( async ( { shell, press } ) => {
88+ openOperatorOverlay ( shell , {
89+ body : "Proceed?" ,
90+ choices : [ "Cancel" , "Continue" ] ,
91+ } ) ;
92+ expect ( shell . overlayKind ) . toBe ( "operator" ) ;
93+
94+ press ( "x" ) ;
95+ expect ( shell . prompt . value ) . toBe ( "" ) ;
96+ expect ( shell . overlayKind ) . toBe ( "operator" ) ;
97+ } ) ;
98+ } ) ;
99+
72100 test ( "claimed overlay keys keep precedence over the prompt" , async ( ) => {
73101 await withShell ( async ( { shell, press } ) => {
74102 openHelpOverlay ( shell ) ;
0 commit comments