From c1fcffca3427082d602a31112bfa0a2ec3e16d9e Mon Sep 17 00:00:00 2001 From: flootr Date: Mon, 1 Feb 2021 17:37:15 +0100 Subject: [PATCH] add `minHeightUnit` to latest core/cover deprecation (#28627) Co-authored-by: Jon Surrell --- packages/block-library/CHANGELOG.md | 4 ++ .../block-library/src/cover/deprecated.js | 3 ++ .../blocks/core__cover__deprecated-6.html | 12 ++++++ .../blocks/core__cover__deprecated-6.json | 36 ++++++++++++++++ .../core__cover__deprecated-6.parsed.json | 41 +++++++++++++++++++ .../core__cover__deprecated-6.serialized.html | 6 +++ 6 files changed, 102 insertions(+) diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index 290c0494ecc85..c048be58f5461 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -8,6 +8,10 @@ - Allow setting the `crossOrigin` attribute so the `useTransformImage` hook can use cross-origin sources ([#28255](https://github.com/WordPress/gutenberg/pull/28255/)). +### Bug Fixes + +- Fix a regression where the Cover block migration would not work with custom units for `minHeight` ([#28627](https://github.com/WordPress/gutenberg/pull/28627)) + ## 2.27.0 (2020-12-17) ### Enhancement diff --git a/packages/block-library/src/cover/deprecated.js b/packages/block-library/src/cover/deprecated.js index b214f3e0ce3ae..a3bab8926aba5 100644 --- a/packages/block-library/src/cover/deprecated.js +++ b/packages/block-library/src/cover/deprecated.js @@ -79,6 +79,9 @@ const deprecated = [ minHeight: { type: 'number', }, + minHeightUnit: { + type: 'string', + }, gradient: { type: 'string', }, diff --git a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.html b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.html index 00094d59af0fa..79f8a553b77af 100644 --- a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.html +++ b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.html @@ -12,3 +12,15 @@ + +
+
+ +

+ +
+
+ diff --git a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.json b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.json index 4709d0adb3670..5a2d306553d61 100644 --- a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.json +++ b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.json @@ -29,5 +29,41 @@ } ], "originalContent": "\n\t
\n\t\t\n\t
\n" + }, + { + "clientId": "_clientId_1", + "name": "core/cover", + "isValid": true, + "attributes": { + "url": "https://example.com/some-background-image.png", + "id": 1933, + "hasParallax": false, + "dimRatio": 0, + "backgroundType": "image", + "focalPoint": { + "x": "0.50", + "y": "0.40" + }, + "title": "", + "contentAlign": "center", + "isRepeated": false, + "minHeight": 48, + "minHeightUnit": "vw", + "className": "alignfull" + }, + "innerBlocks": [ + { + "clientId": "_clientId_0", + "name": "core/paragraph", + "isValid": true, + "attributes": { + "content": "", + "dropCap": false + }, + "innerBlocks": [], + "originalContent": "

" + } + ], + "originalContent": "\n\t
\n\t\t\n\t
\n" } ] diff --git a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.parsed.json b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.parsed.json index c38b616c41d0d..cb1f14786bf34 100644 --- a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.parsed.json +++ b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.parsed.json @@ -27,6 +27,47 @@ "\n\t\n\n" ] }, + { + "blockName": null, + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n", + "innerContent": [ + "\n" + ] + }, + { + "blockName": "core/cover", + "attrs": { + "url": "https://example.com/some-background-image.png", + "id": 1933, + "dimRatio": 0, + "focalPoint": { + "x": "0.50", + "y": "0.40" + }, + "minHeight": 48, + "minHeightUnit": "vw", + "align": "full" + }, + "innerBlocks": [ + { + "blockName": "core/paragraph", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n\t\t

\n\t\t", + "innerContent": [ + "\n\t\t

\n\t\t" + ] + } + ], + "innerHTML": "\n\n\t
\n\t\t\n\t
\n\n", + "innerContent": [ + "\n\n\t
\n\t\t", + null, + "\n\t
\n\n" + ] + }, { "blockName": null, "attrs": {}, diff --git a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.serialized.html b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.serialized.html index b9dfae00e3e66..f079f578eca39 100644 --- a/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.serialized.html +++ b/packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.serialized.html @@ -5,3 +5,9 @@

+ + +
+

+
+