@@ -4658,64 +4658,67 @@ describe( 'selectors', () => {
46584658 } ) ;
46594659
46604660 describe ( 'getActiveBlockIdByBlockName' , ( ) => {
4661- const state = {
4662- selection : {
4663- selectionStart : {
4664- clientId : 'client-id-04' ,
4665- } ,
4666- selectionEnd : {
4667- clientId : 'client-id-04' ,
4661+ let state ;
4662+ beforeEach ( ( ) => {
4663+ state = {
4664+ selection : {
4665+ selectionStart : {
4666+ clientId : 'client-id-04' ,
4667+ } ,
4668+ selectionEnd : {
4669+ clientId : 'client-id-04' ,
4670+ } ,
46684671 } ,
4669- } ,
4670- blocks : {
4671- parents : new Map (
4672- Object . entries ( {
4673- 'client-id-01' : '' ,
4674- 'client-id-02' : 'client-id-01' ,
4675- 'client-id-03' : 'client-id-02' ,
4676- 'client-id-04' : 'client-id-03' ,
4677- 'client-id-05' : 'client-id-03' ,
4678- } )
4679- ) ,
4680- byClientId : new Map (
4681- Object . entries ( {
4682- 'client-id-01' : {
4683- clientId : 'client-id-01' ,
4684- name : 'core/columns' ,
4685- } ,
4686- 'client-id-02' : {
4687- clientId : 'client-id-02' ,
4688- name : 'core/navigation' ,
4689- } ,
4690- 'client-id-03' : {
4691- clientId : 'client-id-03' ,
4692- name : 'core/navigation-link' ,
4693- } ,
4694- 'client-id-04' : {
4695- clientId : 'client-id-04' ,
4696- name : 'core/navigation-link' ,
4697- } ,
4698- 'client-id-05' : {
4699- clientId : 'client-id-05' ,
4700- name : 'core/navigation-link' ,
4701- } ,
4702- } )
4703- ) ,
4704- cache : {
4705- 'client-id-01' : { } ,
4706- 'client-id-02' : { } ,
4707- 'client-id-03' : { } ,
4708- 'client-id-04' : { } ,
4709- 'client-id-05' : { } ,
4672+ blocks : {
4673+ parents : new Map (
4674+ Object . entries ( {
4675+ 'client-id-01' : '' ,
4676+ 'client-id-02' : 'client-id-01' ,
4677+ 'client-id-03' : 'client-id-02' ,
4678+ 'client-id-04' : 'client-id-03' ,
4679+ 'client-id-05' : 'client-id-03' ,
4680+ } )
4681+ ) ,
4682+ byClientId : new Map (
4683+ Object . entries ( {
4684+ 'client-id-01' : {
4685+ clientId : 'client-id-01' ,
4686+ name : 'core/columns' ,
4687+ } ,
4688+ 'client-id-02' : {
4689+ clientId : 'client-id-02' ,
4690+ name : 'core/navigation' ,
4691+ } ,
4692+ 'client-id-03' : {
4693+ clientId : 'client-id-03' ,
4694+ name : 'core/navigation-link' ,
4695+ } ,
4696+ 'client-id-04' : {
4697+ clientId : 'client-id-04' ,
4698+ name : 'core/navigation-link' ,
4699+ } ,
4700+ 'client-id-05' : {
4701+ clientId : 'client-id-05' ,
4702+ name : 'core/navigation-link' ,
4703+ } ,
4704+ } )
4705+ ) ,
4706+ cache : {
4707+ 'client-id-01' : { } ,
4708+ 'client-id-02' : { } ,
4709+ 'client-id-03' : { } ,
4710+ 'client-id-04' : { } ,
4711+ 'client-id-05' : { } ,
4712+ } ,
4713+ order : new Map (
4714+ Object . entries ( {
4715+ 'client-id-03' : [ 'client-id-04' , 'client-id-05' ] ,
4716+ } )
4717+ ) ,
4718+ controlledInnerBlocks : new Set ( ) ,
47104719 } ,
4711- order : new Map (
4712- Object . entries ( {
4713- 'client-id-03' : [ 'client-id-04' , 'client-id-05' ] ,
4714- } )
4715- ) ,
4716- controlledInnerBlocks : new Set ( ) ,
4717- } ,
4718- } ;
4720+ } ;
4721+ } ) ;
47194722 it ( 'Should return first active matching block (including self) when single block selected' , ( ) => {
47204723 expect (
47214724 getActiveBlockIdByBlockNames ( state , [
0 commit comments