@@ -389,6 +389,142 @@ describe('vscode-split-layout', () => {
389389 } ) ;
390390 } ) ;
391391
392+ describe ( 'min size constraints' , ( ) => {
393+ it ( 'prevents dragging the start pane below the configured pixel minimum' , async ( ) => {
394+ const el = await fixture < VscodeSplitLayout > (
395+ html `< vscode-split-layout
396+ style ="width: 500px; height: 300px; "
397+ initial-handle-position ="400px "
398+ min-start ="240px "
399+ > </ vscode-split-layout > `
400+ ) ;
401+
402+ const handle = el . shadowRoot ?. querySelector ( '.handle' ) as HTMLDivElement ;
403+ const startPane = el . shadowRoot ?. querySelector (
404+ '.start'
405+ ) as HTMLDivElement ;
406+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
407+
408+ await dragElement ( handle , - 300 ) ;
409+
410+ expect ( startPane . offsetWidth ) . to . eq ( 240 ) ;
411+ expect ( endPane . offsetWidth ) . to . eq ( 260 ) ;
412+ } ) ;
413+
414+ it ( 'prevents dragging the end pane below the configured pixel minimum' , async ( ) => {
415+ const el = await fixture < VscodeSplitLayout > (
416+ html `< vscode-split-layout
417+ style ="width: 500px; height: 300px; "
418+ initial-handle-position ="200px "
419+ min-end ="180px "
420+ > </ vscode-split-layout > `
421+ ) ;
422+
423+ const handle = el . shadowRoot ?. querySelector ( '.handle' ) as HTMLDivElement ;
424+ const startPane = el . shadowRoot ?. querySelector (
425+ '.start'
426+ ) as HTMLDivElement ;
427+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
428+
429+ await dragElement ( handle , 300 ) ;
430+
431+ expect ( startPane . offsetWidth ) . to . eq ( 320 ) ;
432+ expect ( endPane . offsetWidth ) . to . eq ( 180 ) ;
433+ } ) ;
434+
435+ it ( 'applies percentage-based minimums when handlePosition changes programmatically' , async ( ) => {
436+ const el = await fixture < VscodeSplitLayout > (
437+ html `< vscode-split-layout
438+ style ="width: 600px; height: 300px; "
439+ initial-handle-position ="50% "
440+ min-start ="30% "
441+ min-end ="25% "
442+ > </ vscode-split-layout > `
443+ ) ;
444+
445+ const startPane = el . shadowRoot ?. querySelector (
446+ '.start'
447+ ) as HTMLDivElement ;
448+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
449+
450+ el . handlePosition = '0px' ;
451+ await el . updateComplete ;
452+
453+ expect ( startPane . offsetWidth ) . to . eq ( 180 ) ;
454+ expect ( endPane . offsetWidth ) . to . eq ( 420 ) ;
455+
456+ el . handlePosition = '100%' ;
457+ await el . updateComplete ;
458+
459+ expect ( startPane . offsetWidth ) . to . eq ( 450 ) ;
460+ expect ( endPane . offsetWidth ) . to . eq ( 150 ) ;
461+ } ) ;
462+
463+ it ( 'respects minimum sizes in horizontal layouts' , async ( ) => {
464+ const el = await fixture < VscodeSplitLayout > (
465+ html `< vscode-split-layout
466+ style ="width: 400px; height: 400px; "
467+ split ="horizontal "
468+ initial-handle-position ="300px "
469+ min-start ="150px "
470+ > </ vscode-split-layout > `
471+ ) ;
472+
473+ const handle = el . shadowRoot ?. querySelector ( '.handle' ) as HTMLDivElement ;
474+ const startPane = el . shadowRoot ?. querySelector (
475+ '.start'
476+ ) as HTMLDivElement ;
477+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
478+
479+ await dragElement ( handle , 0 , - 250 ) ;
480+
481+ expect ( startPane . offsetHeight ) . to . eq ( 150 ) ;
482+ expect ( endPane . offsetHeight ) . to . eq ( 250 ) ;
483+ } ) ;
484+
485+ it ( 'handles overlapping minimums without crashing' , async ( ) => {
486+ const el = await fixture < VscodeSplitLayout > (
487+ html `< vscode-split-layout
488+ style ="width: 400px; height: 300px; "
489+ min-start ="110% "
490+ min-end ="110% "
491+ > </ vscode-split-layout > `
492+ ) ;
493+
494+ const startPane = el . shadowRoot ?. querySelector (
495+ '.start'
496+ ) as HTMLDivElement ;
497+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
498+
499+ expect ( startPane . offsetWidth ) . to . be . closeTo ( 400 , 1 ) ;
500+ expect ( endPane . offsetWidth ) . to . be . closeTo ( 0 , 1 ) ;
501+ } ) ;
502+
503+ it ( 'accepts zero minimum values' , async ( ) => {
504+ const el = await fixture < VscodeSplitLayout > (
505+ html `< vscode-split-layout
506+ style ="width: 400px; height: 300px; "
507+ min-start ="0px "
508+ min-end ="0% "
509+ > </ vscode-split-layout > `
510+ ) ;
511+
512+ const handle = el . shadowRoot ?. querySelector ( '.handle' ) as HTMLDivElement ;
513+ const startPane = el . shadowRoot ?. querySelector (
514+ '.start'
515+ ) as HTMLDivElement ;
516+ const endPane = el . shadowRoot ?. querySelector ( '.end' ) as HTMLDivElement ;
517+
518+ await dragElement ( handle , - 400 ) ;
519+ expect ( startPane . offsetWidth ) . to . be . closeTo ( 0 , 1 ) ;
520+ expect ( endPane . offsetWidth ) . to . be . closeTo ( 400 , 1 ) ;
521+
522+ await dragElement ( handle , 400 ) ;
523+ expect ( startPane . offsetWidth ) . to . be . closeTo ( 400 , 1 ) ;
524+ expect ( endPane . offsetWidth ) . to . be . closeTo ( 0 , 1 ) ;
525+ } ) ;
526+ } ) ;
527+
392528 describe ( 'interactions' , ( ) => {
393529 it ( 'should panes resize in vertical mode' , async ( ) => {
394530 const el = await fixture < VscodeSplitLayout > (
0 commit comments