diff --git a/packages/block-library/src/navigation/deprecated.js b/packages/block-library/src/navigation/deprecated.js index 64960ac6d37cab..7b570a4600881b 100644 --- a/packages/block-library/src/navigation/deprecated.js +++ b/packages/block-library/src/navigation/deprecated.js @@ -26,22 +26,23 @@ const migrateWithLayout = ( attributes ) => { return attributes; } - const { itemsJustification, orientation } = attributes; - - const updatedAttributes = { - ...attributes, - }; + const { + itemsJustification, + orientation, + ...updatedAttributes + } = attributes; if ( itemsJustification || orientation ) { Object.assign( updatedAttributes, { layout: { type: 'flex', - justifyContent: itemsJustification || 'left', - orientation: orientation || 'horizontal', + setCascadingProperties: 'true', + ...( itemsJustification && { + justifyContent: itemsJustification, + } ), + ...( orientation && { orientation } ), }, } ); - delete updatedAttributes.itemsJustification; - delete updatedAttributes.orientation; } return updatedAttributes; diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-1.json b/test/integration/fixtures/blocks/core__navigation__deprecated-1.json index fca0c7fb5d2a01..69a9ac1b8d44d1 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-1.json +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-1.json @@ -9,7 +9,7 @@ "overlayMenu": "mobile", "layout": { "type": "flex", - "justifyContent": "left", + "setCascadingProperties": "true", "orientation": "horizontal" } }, diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-1.serialized.html b/test/integration/fixtures/blocks/core__navigation__deprecated-1.serialized.html index 15fcfd3733fe0e..be383041468002 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-1.serialized.html +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-1.serialized.html @@ -1,3 +1,3 @@ - + diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-v4.json b/test/integration/fixtures/blocks/core__navigation__deprecated-v4.json index c35ba1a1f995c0..2796f5d9fe8fd2 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-v4.json +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-v4.json @@ -10,7 +10,7 @@ "fontFamily": "cambria-georgia", "layout": { "type": "flex", - "justifyContent": "left", + "setCascadingProperties": "true", "orientation": "horizontal" } }, diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-v4.serialized.html b/test/integration/fixtures/blocks/core__navigation__deprecated-v4.serialized.html index fd5a89ce7ec166..85ecd3fd940242 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-v4.serialized.html +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-v4.serialized.html @@ -1 +1 @@ - + diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-v5.json b/test/integration/fixtures/blocks/core__navigation__deprecated-v5.json index a7f66f17027c1b..b851644f32aedf 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-v5.json +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-v5.json @@ -9,6 +9,7 @@ "overlayMenu": "never", "layout": { "type": "flex", + "setCascadingProperties": "true", "justifyContent": "center", "orientation": "vertical" } diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated-v5.serialized.html b/test/integration/fixtures/blocks/core__navigation__deprecated-v5.serialized.html index 688b6c199ed9df..8166dfb51a1be2 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated-v5.serialized.html +++ b/test/integration/fixtures/blocks/core__navigation__deprecated-v5.serialized.html @@ -1 +1 @@ - + diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated.json b/test/integration/fixtures/blocks/core__navigation__deprecated.json index 7b4e691b4e2ce4..a9df1a99a149e7 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated.json +++ b/test/integration/fixtures/blocks/core__navigation__deprecated.json @@ -15,7 +15,7 @@ }, "layout": { "type": "flex", - "justifyContent": "left", + "setCascadingProperties": "true", "orientation": "horizontal" } }, diff --git a/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html b/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html index 2a0269ea2b58b1..e3a1a7ee035826 100644 --- a/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html +++ b/test/integration/fixtures/blocks/core__navigation__deprecated.serialized.html @@ -1,3 +1,3 @@ - +