@@ -174,7 +174,7 @@ describe('EmbedMountService', () => {
174174 expect ( focusOwnerService . getFocusOwner ( ) ) . toMatchObject ( { embedId : 'embed-1' , childUnitId : 'child-sheet' } ) ;
175175 } ) ;
176176
177- it ( 'activates tab sessions and updates host focus contexts ' , ( ) => {
177+ it ( 'mounts tab sessions without activating them until the child receives focus ' , ( ) => {
178178 const firstHost = document . createElement ( 'div' ) ;
179179 const secondHost = document . createElement ( 'div' ) ;
180180 const hosts = [ firstHost , secondHost ] ;
@@ -232,26 +232,22 @@ describe('EmbedMountService', () => {
232232 popupPortal . className = 'univer-popup' ;
233233 document . body . appendChild ( popupPortal ) ;
234234
235- expect ( firstHost . dataset . embedRenderScopeActive ) . toBe ( 'false ' ) ;
235+ expect ( firstHost . dataset . embedRenderScopeActive ) . toBe ( 'true ' ) ;
236236 expect ( secondHost . dataset . embedRenderScopeActive ) . toBe ( 'true' ) ;
237237 expect ( firstHost . getAttribute ( EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE ) ) . toBe ( 'tab-1' ) ;
238238 expect ( firstHost . getAttribute ( EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE ) ) . toBe ( 'runtime' ) ;
239239 expect ( interactionBoundaryService . contains ( 'tab-1' , firstChildInput ) ) . toBe ( true ) ;
240240 expect ( focusCoordinator . isChildUnitRuntimeEvent ( 'child-1' , firstChildInput ) ) . toBe ( true ) ;
241241 expect ( focusCoordinator . isChildUnitRuntimeEvent ( 'host-1' , firstChildInput ) ) . toBe ( false ) ;
242- expect ( firstHost . getAttribute ( 'aria-hidden' ) ) . toBe ( 'true' ) ;
242+ expect ( firstHost . getAttribute ( 'aria-hidden' ) ) . toBeNull ( ) ;
243243 expect ( secondHost . getAttribute ( 'aria-hidden' ) ) . toBeNull ( ) ;
244- expect ( instanceService . setCurrentUnitForType ) . toHaveBeenCalledWith ( 'child-2' ) ;
245- expect ( instanceService . focusUnit ) . toHaveBeenCalledWith ( 'child-2' ) ;
246- expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_UNIT , true ) ;
247- expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_SHEET , true ) ;
248- expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_DOC , false ) ;
249- expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_SLIDE , false ) ;
250- expect ( focusOwnerService . getFocusOwner ( ) ) . toMatchObject ( { embedId : 'tab-2' , childUnitId : 'child-2' } ) ;
244+ expect ( instanceService . setCurrentUnitForType ) . not . toHaveBeenCalled ( ) ;
245+ expect ( instanceService . focusUnit ) . not . toHaveBeenCalled ( ) ;
246+ expect ( contextService . setContextValue ) . not . toHaveBeenCalled ( ) ;
247+ expect ( focusOwnerService . getFocusOwner ( ) ) . toBeNull ( ) ;
251248 firstChildInput . dispatchEvent ( new PointerEvent ( 'pointerdown' , { bubbles : true } ) ) ;
252249 expect ( popupPortal . getAttribute ( EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE ) ) . toBe ( 'tab-1' ) ;
253250 expect ( popupPortal . getAttribute ( EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE ) ) . toBe ( 'child-popup' ) ;
254- firstHost . dispatchEvent ( new FocusEvent ( 'focusin' , { bubbles : true } ) ) ;
255251 expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_UNIT , true ) ;
256252 expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_DOC , true ) ;
257253 expect ( contextService . setContextValue ) . toHaveBeenCalledWith ( FOCUSING_SHEET , false ) ;
0 commit comments