@@ -68,11 +68,11 @@ jest.mock('./hooks', () => ({
6868
6969// Mock validation helpers to be deterministic
7070jest . mock ( './validation' , ( ) => ( {
71- validateManagedFlyoutSize : ( ) => undefined ,
72- validateSizeCombination : ( ) => undefined ,
73- validateFlyoutTitle : ( ) => undefined ,
74- createValidationErrorMessage : ( e : any ) => String ( e ) ,
75- isNamedSize : ( ) => true ,
71+ validateManagedFlyoutSize : jest . fn ( ( ) => undefined ) ,
72+ validateSizeCombination : jest . fn ( ( ) => undefined ) ,
73+ validateFlyoutTitle : jest . fn ( ( ) => undefined ) ,
74+ createValidationErrorMessage : jest . fn ( ( e : any ) => String ( e ) ) ,
75+ isNamedSize : jest . fn ( ( ) => true ) ,
7676} ) ) ;
7777
7878// Mock resize observer hook to return a fixed width
@@ -123,4 +123,113 @@ describe('EuiManagedFlyout', () => {
123123 LEVEL_CHILD
124124 ) ;
125125 } ) ;
126+
127+ describe ( 'flyoutMenuProps integration' , ( ) => {
128+ it ( 'passes flyoutMenuProps to the underlying flyout component' , ( ) => {
129+ const flyoutMenuProps = {
130+ title : 'Test Menu' ,
131+ hideCloseButton : true ,
132+ customActions : [
133+ {
134+ iconType : 'gear' ,
135+ onClick : jest . fn ( ) ,
136+ 'aria-label' : 'Settings' ,
137+ } ,
138+ ] ,
139+ } ;
140+
141+ const { getByTestSubject } = renderInProvider (
142+ < EuiManagedFlyout
143+ id = "test-flyout"
144+ level = { LEVEL_MAIN }
145+ onClose = { ( ) => { } }
146+ flyoutMenuProps = { flyoutMenuProps }
147+ />
148+ ) ;
149+
150+ const el = getByTestSubject ( 'managed-flyout' ) ;
151+ expect ( el ) . toHaveAttribute ( 'data-test-subj' , 'managed-flyout' ) ;
152+ } ) ;
153+
154+ it ( 'merges flyoutMenuProps with extracted title from flyoutMenuProps.title' , ( ) => {
155+ const flyoutMenuProps = {
156+ title : 'Original Title' ,
157+ hideCloseButton : false ,
158+ } ;
159+
160+ const { getByTestSubject } = renderInProvider (
161+ < EuiManagedFlyout
162+ id = "test-flyout"
163+ level = { LEVEL_MAIN }
164+ onClose = { ( ) => { } }
165+ flyoutMenuProps = { flyoutMenuProps }
166+ />
167+ ) ;
168+
169+ const el = getByTestSubject ( 'managed-flyout' ) ;
170+ expect ( el ) . toHaveAttribute ( 'data-test-subj' , 'managed-flyout' ) ;
171+ } ) ;
172+
173+ it ( 'merges flyoutMenuProps with extracted title from aria-label' , ( ) => {
174+ const flyoutMenuProps = {
175+ hideCloseButton : true ,
176+ customActions : [ ] ,
177+ } ;
178+
179+ const { getByTestSubject } = renderInProvider (
180+ < EuiManagedFlyout
181+ id = "test-flyout"
182+ level = { LEVEL_MAIN }
183+ onClose = { ( ) => { } }
184+ aria-label = "Aria Label Title"
185+ flyoutMenuProps = { flyoutMenuProps }
186+ />
187+ ) ;
188+
189+ const el = getByTestSubject ( 'managed-flyout' ) ;
190+ expect ( el ) . toHaveAttribute ( 'data-test-subj' , 'managed-flyout' ) ;
191+ } ) ;
192+ } ) ;
193+
194+ describe ( 'title handling' , ( ) => {
195+ it ( 'renders successfully when title is provided via flyoutMenuProps' , ( ) => {
196+ const flyoutMenuProps = { title : 'Test Title' } ;
197+
198+ const { getByTestSubject } = renderInProvider (
199+ < EuiManagedFlyout
200+ id = "test-flyout"
201+ level = { LEVEL_MAIN }
202+ onClose = { ( ) => { } }
203+ flyoutMenuProps = { flyoutMenuProps }
204+ />
205+ ) ;
206+
207+ expect ( getByTestSubject ( 'managed-flyout' ) ) . toBeInTheDocument ( ) ;
208+ } ) ;
209+
210+ it ( 'renders successfully when title is provided via aria-label' , ( ) => {
211+ const { getByTestSubject } = renderInProvider (
212+ < EuiManagedFlyout
213+ id = "test-flyout"
214+ level = { LEVEL_MAIN }
215+ onClose = { ( ) => { } }
216+ aria-label = "Aria Label Title"
217+ />
218+ ) ;
219+
220+ expect ( getByTestSubject ( 'managed-flyout' ) ) . toBeInTheDocument ( ) ;
221+ } ) ;
222+
223+ it ( 'renders successfully for child flyouts without title' , ( ) => {
224+ const { getByTestSubject } = renderInProvider (
225+ < EuiManagedFlyout
226+ id = "child-flyout"
227+ level = { LEVEL_CHILD }
228+ onClose = { ( ) => { } }
229+ />
230+ ) ;
231+
232+ expect ( getByTestSubject ( 'managed-flyout' ) ) . toBeInTheDocument ( ) ;
233+ } ) ;
234+ } ) ;
126235} ) ;
0 commit comments