@@ -127,26 +127,31 @@ describe.skipIf(!hasBrowserLayout)("openclaw-board-view browser layout", () => {
127127
128128 it ( "reveals widget chrome while the widget has focus" , async ( ) => {
129129 const view = await mount ( ) ;
130+ view . style . width = "1200px" ;
130131 const sink = focusSink ( ) ;
131132 const widget = view . querySelector < HTMLElement > ( '[data-test-id="board-widget"]' ) ;
132133 const bar = widget ! . querySelector < HTMLElement > ( ".board-widget__bar" ) ;
133134
134135 widget ! . focus ( ) ;
135136 expect ( getComputedStyle ( bar ! ) . visibility ) . toBe ( "visible" ) ;
136- // Chrome is a compact top-left pill, not a full-width strip: it must not
137- // stretch across the card, so widget-owned top-right actions stay clear.
137+ // Chrome is a compact centered pill, not a full-width strip: it must not
138+ // stretch across the card, so widget-owned corner actions stay clear.
138139 const barBounds = bar ! . getBoundingClientRect ( ) ;
139140 const widgetBounds = widget ! . getBoundingClientRect ( ) ;
140141 expect ( barBounds . width ) . toBeLessThan ( widgetBounds . width * 0.75 ) ;
141- expect ( barBounds . left - widgetBounds . left ) . toBeLessThan ( widgetBounds . right - barBounds . right ) ;
142+ expect ( barBounds . left + barBounds . width / 2 ) . toBeCloseTo (
143+ widgetBounds . left + widgetBounds . width / 2 ,
144+ 0 ,
145+ ) ;
142146
143147 sink . focus ( ) ;
144148 expect ( widget ! . matches ( ":focus-within" ) ) . toBe ( false ) ;
145149 await vi . waitFor ( ( ) => expectChromeHidden ( widget ! , bar ! ) ) ;
146150 } ) ;
147151
148- it ( "reserves the top-right action corner even for narrow long-titled widgets " , async ( ) => {
152+ it ( "compacts centered chrome at intermediate widths " , async ( ) => {
149153 const view = await mount ( ) ;
154+ view . style . width = "700px" ;
150155 view . snapshot = {
151156 ...structuredClone ( source ) ,
152157 widgets : [
@@ -165,10 +170,19 @@ describe.skipIf(!hasBrowserLayout)("openclaw-board-view browser layout", () => {
165170 const bar = widget ! . querySelector < HTMLElement > ( ".board-widget__bar" ) ;
166171 widget ! . focus ( ) ;
167172 expect ( getComputedStyle ( bar ! ) . visibility ) . toBe ( "visible" ) ;
168- // The interactive pill reserves a widget-owned right-hand region and none
169- // of its children may overflow the capped box into that corner.
170173 const widgetBounds = widget ! . getBoundingClientRect ( ) ;
171- expect ( widgetBounds . right - bar ! . getBoundingClientRect ( ) . right ) . toBeGreaterThanOrEqual ( 88 ) ;
174+ const barBounds = bar ! . getBoundingClientRect ( ) ;
175+ expect ( widgetBounds . width ) . toBeGreaterThan ( 264 ) ;
176+ expect ( widgetBounds . width ) . toBeLessThanOrEqual ( 376 ) ;
177+ expect ( barBounds . left + barBounds . width / 2 ) . toBeCloseTo (
178+ widgetBounds . left + widgetBounds . width / 2 ,
179+ 0 ,
180+ ) ;
181+ expect ( barBounds . left - widgetBounds . left ) . toBeGreaterThanOrEqual ( 88 ) ;
182+ expect ( widgetBounds . right - barBounds . right ) . toBeGreaterThanOrEqual ( 88 ) ;
183+ for ( const selector of [ ".board-widget__title" , ".board-widget__kind" ] ) {
184+ expect ( getComputedStyle ( bar ! . querySelector < HTMLElement > ( selector ) ! ) . display ) . toBe ( "none" ) ;
185+ }
172186 for ( const child of bar ! . children ) {
173187 expect ( child . getBoundingClientRect ( ) . right ) . toBeLessThanOrEqual (
174188 bar ! . getBoundingClientRect ( ) . right + 1 ,
@@ -196,15 +210,17 @@ describe.skipIf(!hasBrowserLayout)("openclaw-board-view browser layout", () => {
196210 const bar = widget ! . querySelector < HTMLElement > ( ".board-widget__bar" ) ;
197211 widget ! . focus ( ) ;
198212 expect ( getComputedStyle ( bar ! ) . visibility ) . toBe ( "visible" ) ;
199- // Below the 184px container threshold the display-only pieces disappear so
200- // the pill is the irreducible move + menu pair and the rest of the card
201- // stays widget-owned.
213+ // Very narrow cards keep the irreducible move + menu pair while the rest of
214+ // the card stays widget-owned.
202215 expect ( widget ! . getBoundingClientRect ( ) . width ) . toBeLessThan ( 184 ) ;
203216 const title = bar ! . querySelector < HTMLElement > ( ".board-widget__title" ) ;
204217 const kind = bar ! . querySelector < HTMLElement > ( ".board-widget__kind" ) ;
205218 expect ( getComputedStyle ( title ! ) . display ) . toBe ( "none" ) ;
206219 expect ( getComputedStyle ( kind ! ) . display ) . toBe ( "none" ) ;
207- expect ( bar ! . getBoundingClientRect ( ) . width ) . toBeLessThanOrEqual ( 76 ) ;
220+ const widgetBounds = widget ! . getBoundingClientRect ( ) ;
221+ const barBounds = bar ! . getBoundingClientRect ( ) ;
222+ expect ( barBounds . width ) . toBeLessThanOrEqual ( 76 ) ;
223+ expect ( barBounds . left - widgetBounds . left ) . toBeLessThan ( widgetBounds . right - barBounds . right ) ;
208224 } ) ;
209225
210226 it ( "keeps widget chrome visible while its menu is open" , async ( ) => {
0 commit comments