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