@@ -51,7 +51,13 @@ describe("chat canvas layout", () => {
5151
5252 it ( "centers chat in the whole container without a preview" , ( ) => {
5353 expect ( resolve ( 1344 , null ) . chat ) . toEqual ( { left : 288 , width : 768 , insetStart : 0 , insetEnd : 0 } ) ;
54- expect ( resolve ( 390 , null ) . chat ) . toEqual ( { left : 20 , width : 350 , insetStart : 0 , insetEnd : 0 } ) ;
54+ expect (
55+ resolveChatCanvasLayout ( {
56+ container : { width : 390 , height : 900 } ,
57+ preview : null ,
58+ padding : 12 ,
59+ } ) . chat ,
60+ ) . toEqual ( { left : 12 , width : 366 , insetStart : 0 , insetEnd : 0 } ) ;
5561 } ) ;
5662 it ( "does not move chat when a bottom-right preview fits in its margin" , ( ) => {
5763 const result = resolve ( 1600 ) ;
@@ -66,21 +72,21 @@ describe("chat canvas layout", () => {
6672 } ) ;
6773 it ( "shrinks chat modestly after using the left margin" , ( ) => {
6874 const result = resolve ( 1200 , { ...preview , width : 480 } ) ;
69- expect ( result . chat . width ) . toBe ( 676 ) ;
70- expect ( result . chat . left ) . toBe ( 20 ) ;
75+ expect ( result . chat . width ) . toBe ( 648 ) ;
76+ expect ( result . chat . left ) . toBe ( 48 ) ;
7177 expectClear ( result ) ;
7278 } ) ;
7379 it ( "stops leftward dragging before the player can push chat to the right" , ( ) => {
7480 const centered = resolve ( 1344 , null ) . chat ;
75- for ( const x of [ 1100 , 800 , 672 , 600 , 400 , 12 , - 100 ] ) {
81+ for ( const x of [ 1100 , 800 , 700 , 600 , 400 , 12 , - 100 ] ) {
7682 const result = resolve ( 1344 , { ...preview , position : { x, y : 500 } } ) ;
77- expect ( result . frame ! . x ) . toBeGreaterThanOrEqual ( 672 ) ;
83+ expect ( result . frame ! . x ) . toBeGreaterThanOrEqual ( 700 ) ;
7884 expect ( result . chat . left ) . toBeLessThanOrEqual ( centered . left ) ;
7985 expect ( result . chat . insetStart ) . toBe ( 0 ) ;
8086 expect ( result . chat . width ) . toBeGreaterThanOrEqual ( 640 ) ;
8187 expectClear ( result ) ;
8288 }
83- expect ( resolve ( 1344 , { ...preview , position : { x : 12 , y : 500 } } ) . frame ! . x ) . toBe ( 672 ) ;
89+ expect ( resolve ( 1344 , { ...preview , position : { x : 12 , y : 500 } } ) . frame ! . x ) . toBe ( 700 ) ;
8490 } ) ;
8591 it ( "keeps a dragged player above the composer when no readable lane fits beside it" , ( ) => {
8692 const result = resolve ( 1000 , { ...preview , position : { x : 12 , y : 700 } } ) ;
@@ -171,8 +177,8 @@ describe("chat canvas layout", () => {
171177 expect ( shifted . overlapsDetailsCard ) . toBe ( false ) ;
172178 expectClear ( shifted ) ;
173179
174- const narrowed = layout ( 560 ) ;
175- expect ( narrowed . frame ! . width ) . toBe ( 560 ) ;
180+ const narrowed = layout ( 532 ) ;
181+ expect ( narrowed . frame ! . width ) . toBe ( 532 ) ;
176182 expect ( narrowed . chat . width ) . toBe ( 656 ) ;
177183 expect ( narrowed . overlapsDetailsCard ) . toBe ( false ) ;
178184 expectClear ( narrowed ) ;
@@ -182,7 +188,7 @@ describe("chat canvas layout", () => {
182188 expect ( grown . overlapsDetailsCard ) . toBe ( true ) ;
183189 expect ( grown . overlapsChat ) . toBe ( false ) ;
184190 expectClear ( grown ) ;
185- expect ( layout ( 560 ) ) . toEqual ( narrowed ) ;
191+ expect ( layout ( 532 ) ) . toEqual ( narrowed ) ;
186192 } ) ;
187193 it . each ( [ "west" , "north" ] as const ) (
188194 "folds the card before moving a %s resize beside it" ,
@@ -214,7 +220,7 @@ describe("chat canvas layout", () => {
214220 const density = ( result : ReturnType < typeof layout > ) => {
215221 const card = resolveThreadDetailsCardLayout ( {
216222 container,
217- lane : { padding : 20 , minChatWidth : 640 } ,
223+ lane : { padding : 48 , minChatWidth : 640 } ,
218224 frame : result . frame ,
219225 overlapsDetailsCard : result . overlapsDetailsCard ,
220226 } ) ;
@@ -274,16 +280,30 @@ describe("workspace card beside chat", () => {
274280 expect ( withCard ( 1147 ) . chat ) . toEqual ( { left : 87 , width : 736 , insetStart : 0 , insetEnd : 237 } ) ;
275281 } ) ;
276282 it ( "narrows chat only after it reaches the left padding" , ( ) => {
277- expect ( withCard ( 1080 ) . chat ) . toMatchObject ( { left : 20 , width : 736 } ) ;
278- expect ( withCard ( 1000 ) . chat ) . toEqual ( { left : 20 , width : 656 , insetStart : 0 , insetEnd : 304 } ) ;
279- expect ( withCard ( 984 ) . chat ) . toMatchObject ( { left : 20 , width : 640 } ) ;
283+ expect ( withCard ( 1108 ) . chat ) . toMatchObject ( { left : 48 , width : 736 } ) ;
284+ expect ( withCard ( 1028 ) . chat ) . toEqual ( { left : 48 , width : 656 , insetStart : 0 , insetEnd : 276 } ) ;
285+ expect ( withCard ( 1012 ) . chat ) . toMatchObject ( { left : 48 , width : 640 } ) ;
286+ } ) ;
287+ it ( "reserves the marker gutter across widths where the details card fits" , ( ) => {
288+ for ( let width = 1012 ; width <= 1440 ; width ++ ) {
289+ const container = { width, height : 900 } ;
290+ const card = resolveThreadDetailsCardLayout ( {
291+ container,
292+ lane : { padding : 48 , minChatWidth : 640 } ,
293+ frame : null ,
294+ } ) ! ;
295+ const chat = withCard ( width ) . chat ;
296+ expect ( chat . left ) . toBeGreaterThanOrEqual ( 48 ) ;
297+ expect ( chat . width ) . toBeGreaterThanOrEqual ( 640 ) ;
298+ expect ( card . x - chat . left - chat . width ) . toBeGreaterThanOrEqual ( 32 ) ;
299+ }
280300 } ) ;
281301 it ( "keeps a full-width chat clear of the card" , ( ) => {
282302 expect ( withCard ( 1147 , null , 10_000 ) . chat ) . toEqual ( {
283- left : 20 ,
284- width : 803 ,
303+ left : 48 ,
304+ width : 775 ,
285305 insetStart : 0 ,
286- insetEnd : 304 ,
306+ insetEnd : 276 ,
287307 } ) ;
288308 } ) ;
289309 it ( "keeps centered chat in place when a new preview opens below the card" , ( ) => {
0 commit comments