9
9
import { RawHTML } from '@wordpress/element' ;
10
10
import { symbol } from '@wordpress/icons' ;
11
11
import { select , dispatch } from '@wordpress/data' ;
12
+ import { store as preferencesStore } from '@wordpress/preferences' ;
12
13
13
14
/**
14
15
* Internal dependencies
@@ -4470,7 +4471,6 @@ describe( 'getBlockEditingMode', () => {
4470
4471
4471
4472
const navigationModeStateWithRootSection = {
4472
4473
...baseState ,
4473
- editorMode : 'navigation' ,
4474
4474
settings : {
4475
4475
[ sectionRootClientIdKey ] : 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337' , // The group is the "main" container
4476
4476
} ,
@@ -4480,12 +4480,18 @@ describe( 'getBlockEditingMode', () => {
4480
4480
4481
4481
const fauxPrivateAPIs = { } ;
4482
4482
4483
- lock ( fauxPrivateAPIs , { hasContentRoleAttribute } ) ;
4483
+ lock ( fauxPrivateAPIs , {
4484
+ hasContentRoleAttribute,
4485
+ } ) ;
4484
4486
4485
4487
getBlockEditingMode . registry = {
4486
4488
select : jest . fn ( ( ) => fauxPrivateAPIs ) ,
4487
4489
} ;
4488
4490
4491
+ afterEach ( ( ) => {
4492
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , undefined ) ;
4493
+ } ) ;
4494
+
4489
4495
it ( 'should return default by default' , ( ) => {
4490
4496
expect (
4491
4497
getBlockEditingMode (
@@ -4610,6 +4616,7 @@ describe( 'getBlockEditingMode', () => {
4610
4616
} ) ;
4611
4617
4612
4618
it ( 'in navigation mode, the root section container is default' , ( ) => {
4619
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , 'navigation' ) ;
4613
4620
expect (
4614
4621
getBlockEditingMode (
4615
4622
navigationModeStateWithRootSection ,
@@ -4619,6 +4626,7 @@ describe( 'getBlockEditingMode', () => {
4619
4626
} ) ;
4620
4627
4621
4628
it ( 'in navigation mode, anything outside the section container is disabled' , ( ) => {
4629
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , 'navigation' ) ;
4622
4630
expect (
4623
4631
getBlockEditingMode (
4624
4632
navigationModeStateWithRootSection ,
@@ -4628,6 +4636,7 @@ describe( 'getBlockEditingMode', () => {
4628
4636
} ) ;
4629
4637
4630
4638
it ( 'in navigation mode, sections are contentOnly' , ( ) => {
4639
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , 'navigation' ) ;
4631
4640
expect (
4632
4641
getBlockEditingMode (
4633
4642
navigationModeStateWithRootSection ,
@@ -4643,6 +4652,7 @@ describe( 'getBlockEditingMode', () => {
4643
4652
} ) ;
4644
4653
4645
4654
it ( 'in navigation mode, blocks with content attributes within sections are contentOnly' , ( ) => {
4655
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , 'navigation' ) ;
4646
4656
hasContentRoleAttribute . mockReturnValueOnce ( true ) ;
4647
4657
expect (
4648
4658
getBlockEditingMode (
@@ -4661,6 +4671,7 @@ describe( 'getBlockEditingMode', () => {
4661
4671
} ) ;
4662
4672
4663
4673
it ( 'in navigation mode, blocks without content attributes within sections are disabled' , ( ) => {
4674
+ dispatch ( preferencesStore ) . set ( 'core' , 'editorTool' , 'navigation' ) ;
4664
4675
expect (
4665
4676
getBlockEditingMode (
4666
4677
navigationModeStateWithRootSection ,
0 commit comments