@@ -44,7 +44,7 @@ describe('Flyout Size Validation', () => {
4444 expect ( error ) . toEqual ( {
4545 type : 'INVALID_SIZE_TYPE' ,
4646 message :
47- 'Managed flyouts must use named sizes (s, m, l). Received: 100px' ,
47+ 'Managed flyouts must use named sizes (s, m, l, fill ). Received: 100px' ,
4848 flyoutId : 'test-id' ,
4949 level : 'main' ,
5050 size : '100px' ,
@@ -58,6 +58,10 @@ describe('Flyout Size Validation', () => {
5858 expect ( validateSizeCombination ( 's' , 'l' ) ) . toBeNull ( ) ;
5959 expect ( validateSizeCombination ( 'm' , 's' ) ) . toBeNull ( ) ;
6060 expect ( validateSizeCombination ( 'm' , 'l' ) ) . toBeNull ( ) ;
61+ expect ( validateSizeCombination ( 's' , 'fill' ) ) . toBeNull ( ) ;
62+ expect ( validateSizeCombination ( 'm' , 'fill' ) ) . toBeNull ( ) ;
63+ expect ( validateSizeCombination ( 'fill' , 's' ) ) . toBeNull ( ) ;
64+ expect ( validateSizeCombination ( 'fill' , 'm' ) ) . toBeNull ( ) ;
6165 } ) ;
6266
6367 it ( 'should return error when parent and child are both m' , ( ) => {
@@ -69,6 +73,15 @@ describe('Flyout Size Validation', () => {
6973 } ) ;
7074 } ) ;
7175
76+ it ( 'should return error when parent and child are both fill' , ( ) => {
77+ const error = validateSizeCombination ( 'fill' , 'fill' ) ;
78+ expect ( error ) . toEqual ( {
79+ type : 'INVALID_SIZE_COMBINATION' ,
80+ message : 'Parent and child flyouts cannot both be size "fill"' ,
81+ size : 'fill' ,
82+ } ) ;
83+ } ) ;
84+
7285 it ( 'should return error when parent is l and there is a child' , ( ) => {
7386 const error = validateSizeCombination ( 'l' , 's' ) ;
7487 expect ( error ) . toEqual ( {
@@ -94,10 +107,17 @@ describe('Flyout Size Validation', () => {
94107 'Parent and child flyouts cannot both be size "m"'
95108 ) ;
96109
97- // Parent 'l' with child should fail
98- const error2 = validateFlyoutSize ( 's ' , 'child-id' , 'child' , 'l ' ) ;
110+ // Parent and child both 'fill' should fail
111+ const error2 = validateFlyoutSize ( 'fill ' , 'child-id' , 'child' , 'fill ' ) ;
99112 expect ( error2 ?. type ) . toBe ( 'INVALID_SIZE_COMBINATION' ) ;
100113 expect ( error2 ?. message ) . toContain (
114+ 'Parent and child flyouts cannot both be size "fill"'
115+ ) ;
116+
117+ // Parent 'l' with child should fail
118+ const error3 = validateFlyoutSize ( 's' , 'child-id' , 'child' , 'l' ) ;
119+ expect ( error3 ?. type ) . toBe ( 'INVALID_SIZE_COMBINATION' ) ;
120+ expect ( error3 ?. message ) . toContain (
101121 'Parent flyouts cannot be size "l" when there is a child flyout'
102122 ) ;
103123 } ) ;
@@ -106,6 +126,8 @@ describe('Flyout Size Validation', () => {
106126 expect ( validateFlyoutSize ( 's' , 'child-id' , 'child' , 'm' ) ) . toBeNull ( ) ;
107127 expect ( validateFlyoutSize ( 'l' , 'child-id' , 'child' , 'm' ) ) . toBeNull ( ) ;
108128 expect ( validateFlyoutSize ( 's' , 'child-id' , 'child' , 's' ) ) . toBeNull ( ) ;
129+ expect ( validateFlyoutSize ( 'fill' , 'child-id' , 'child' , 'm' ) ) . toBeNull ( ) ;
130+ expect ( validateFlyoutSize ( 's' , 'child-id' , 'child' , 'fill' ) ) . toBeNull ( ) ;
109131 } ) ;
110132 } ) ;
111133
@@ -138,5 +160,18 @@ describe('Flyout Size Validation', () => {
138160 'EuiFlyout validation error: Parent and child flyouts cannot both be size "m"'
139161 ) ;
140162 } ) ;
163+
164+ it ( 'should create error message for invalid fill size combination' , ( ) => {
165+ const error : FlyoutSizeValidationError = {
166+ type : 'INVALID_SIZE_COMBINATION' ,
167+ message : 'Parent and child flyouts cannot both be size "fill"' ,
168+ size : 'fill' ,
169+ } ;
170+
171+ const message = createValidationErrorMessage ( error ) ;
172+ expect ( message ) . toBe (
173+ 'EuiFlyout validation error: Parent and child flyouts cannot both be size "fill"'
174+ ) ;
175+ } ) ;
141176 } ) ;
142177} ) ;
0 commit comments