@@ -438,7 +438,7 @@ describe('EuiFlyout', () => {
438438 } ) ;
439439
440440 describe ( 'flyout routing logic' , ( ) => {
441- it ( 'routes to child flyout when session is undefined and there is an active session' , ( ) => {
441+ it ( 'routes to child flyout when session is "inherit" and there is an active session' , ( ) => {
442442 // First render with just the main flyout to establish a session
443443 const { rerender, getByTestSubject } = render (
444444 < EuiFlyoutManager >
@@ -463,7 +463,7 @@ describe('EuiFlyout', () => {
463463 < EuiFlyout
464464 onClose = { ( ) => { } }
465465 data-test-subj = "child-flyout"
466- // session is undefined (not explicitly set)
466+ session = "inherit"
467467 />
468468 </ EuiFlyoutManager >
469469 ) ;
@@ -514,7 +514,27 @@ describe('EuiFlyout', () => {
514514 expect ( flyout ) . not . toHaveAttribute ( 'data-managed-flyout-level' ) ;
515515 } ) ;
516516
517- it ( 'routes to child flyout when in managed context and there is an active session' , ( ) => {
517+ it ( 'routes to standard flyout when session undefined and there is an active session' , ( ) => {
518+ const { getByTestSubject } = render (
519+ < EuiFlyoutManager >
520+ { /* Create an active session */ }
521+ < EuiFlyout
522+ onClose = { ( ) => { } }
523+ session = "start"
524+ flyoutMenuProps = { { title : 'Main Flyout' } }
525+ data-test-subj = "main-flyout"
526+ />
527+ { /* This flyout opted out of session management by default */ }
528+ < EuiFlyout onClose = { ( ) => { } } data-test-subj = "standard-flyout" />
529+ </ EuiFlyoutManager >
530+ ) ;
531+
532+ // Should render as standard flyout (EuiFlyoutComponent)
533+ const flyout = getByTestSubject ( 'standard-flyout' ) ;
534+ expect ( flyout ) . not . toHaveAttribute ( 'data-managed-flyout-level' ) ;
535+ } ) ;
536+
537+ it ( 'routes to child flyout when session is "inherit" in a managed context and there is an active session' , ( ) => {
518538 // First render with just the main flyout to establish a session
519539 const { rerender, getByTestSubject } = render (
520540 < EuiFlyoutManager >
@@ -539,7 +559,7 @@ describe('EuiFlyout', () => {
539559 < EuiFlyout
540560 onClose = { ( ) => { } }
541561 data-test-subj = "child-flyout"
542- session = { undefined } // Not explicitly set, should inherit
562+ session = " inherit"
543563 />
544564 </ EuiFlyoutManager >
545565 ) ;
@@ -562,5 +582,35 @@ describe('EuiFlyout', () => {
562582 const flyout = getByTestSubject ( 'flyout' ) ;
563583 expect ( flyout ) . not . toHaveAttribute ( 'data-managed-flyout-level' ) ;
564584 } ) ;
585+
586+ it ( 'routes to standard flyout when session="inherit" but there is no active session' , ( ) => {
587+ const { getByTestSubject } = render (
588+ < EuiFlyout
589+ onClose = { ( ) => { } }
590+ data-test-subj = "flyout"
591+ session = "inherit" // Explicitly set to inherit, but no session to inherit from
592+ />
593+ ) ;
594+
595+ // Should gracefully degrade to standard flyout (EuiFlyoutComponent) when no session exists
596+ const flyout = getByTestSubject ( 'flyout' ) ;
597+ expect ( flyout ) . not . toHaveAttribute ( 'data-managed-flyout-level' ) ;
598+ } ) ;
599+
600+ it ( 'routes to standard flyout when session="inherit" within Manager but no active session' , ( ) => {
601+ const { getByTestSubject } = render (
602+ < EuiFlyoutManager >
603+ < EuiFlyout
604+ onClose = { ( ) => { } }
605+ data-test-subj = "flyout"
606+ session = "inherit" // Manager context exists but no main flyout has been created
607+ />
608+ </ EuiFlyoutManager >
609+ ) ;
610+
611+ // Should gracefully degrade to standard flyout when Manager exists but no session is active
612+ const flyout = getByTestSubject ( 'flyout' ) ;
613+ expect ( flyout ) . not . toHaveAttribute ( 'data-managed-flyout-level' ) ;
614+ } ) ;
565615 } ) ;
566616} ) ;
0 commit comments