From 3f7f10e6eb6f3aa3ae21b814a2075d4dcccef650 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 13:38:54 +0100 Subject: [PATCH 01/10] Restore styles for old markup --- packages/block-library/src/cover/style.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/block-library/src/cover/style.scss b/packages/block-library/src/cover/style.scss index 240e398e00d90f..5e7204a3bfdbb0 100644 --- a/packages/block-library/src/cover/style.scss +++ b/packages/block-library/src/cover/style.scss @@ -43,15 +43,22 @@ * - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545 * - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545 */ + + // the first selector is required for old Cover markup + &.has-background-dim:not([class*="-background-color"]), .has-background-dim:not([class*="-background-color"]) { background-color: $black; } + // the first selector is required for old Cover markup + &.has-background-dim::before, .has-background-dim::before { content: ""; background-color: inherit; } + // the first selector is required for old Cover markup + &.has-background-dim:not(.has-background-gradient)::before, .has-background-dim:not(.has-background-gradient)::before, .wp-block-cover__gradient-background { position: absolute; From 176a0f3508b3ab6d7f63c15e53f12bd310492c6d Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 15:11:01 +0100 Subject: [PATCH 02/10] Set default dim to 50% for media and 100% for solids --- packages/block-library/src/cover/block.json | 3 +-- packages/block-library/src/cover/edit.js | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index 852b9ab30d1c9b..69611d98aa214b 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -39,8 +39,7 @@ "type": "string" }, "backgroundType": { - "type": "string", - "default": "image" + "type": "string" }, "focalPoint": { "type": "object" diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index f057a2b56291fc..1187a4a00c0af8 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -397,6 +397,15 @@ function CoverEdit( { const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType; const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType; + useEffect( () => { + const defaultDimRatio = + isImageBackground || isVideoBackground ? 50 : 100; + + setAttributes( { + dimRatio: dimRatio || defaultDimRatio, + } ); + }, [ isImageBackground, isVideoBackground ] ); + const [ temporaryMinHeight, setTemporaryMinHeight ] = useState( null ); const minHeightWithUnit = minHeightUnit From 42883f53633ea2e346dca57fc502e354d959ac45 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 15:21:24 +0100 Subject: [PATCH 03/10] Fix transition from Image --- packages/block-library/src/cover/transforms.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/cover/transforms.js b/packages/block-library/src/cover/transforms.js index bc480d497b2f81..f9447f0ee56ea9 100644 --- a/packages/block-library/src/cover/transforms.js +++ b/packages/block-library/src/cover/transforms.js @@ -17,6 +17,7 @@ const transforms = { createBlock( 'core/cover', { + backgroundType: IMAGE_BACKGROUND_TYPE, url, alt, align, From ee4aee0e15ec9ea4ff8d6037832a91107e4995ef Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 17:11:11 +0100 Subject: [PATCH 04/10] Regenerate fixtures --- test/integration/fixtures/blocks/core__cover.html | 12 +++++------- test/integration/fixtures/blocks/core__cover.json | 9 +++++---- .../fixtures/blocks/core__cover.parsed.json | 13 ++++++++----- .../fixtures/blocks/core__cover.serialized.html | 8 +++----- .../core__cover__deprecated-1.serialized.html | 2 +- .../core__cover__deprecated-2.serialized.html | 2 +- .../core__cover__deprecated-3.serialized.html | 2 +- .../core__cover__deprecated-4.serialized.html | 2 +- .../core__cover__deprecated-5.serialized.html | 2 +- .../core__cover__deprecated-6.serialized.html | 6 +++--- .../core__cover__deprecated-7.serialized.html | 2 +- .../blocks/core__cover__gradient-image.html | 10 +++++----- .../blocks/core__cover__gradient-image.json | 11 ++++++----- .../blocks/core__cover__gradient-image.parsed.json | 13 ++++++++----- .../core__cover__gradient-image.serialized.html | 6 +++--- .../fixtures/blocks/core__cover__gradient.json | 1 - .../fixtures/blocks/core__cover__solid-color.json | 1 - 17 files changed, 52 insertions(+), 50 deletions(-) diff --git a/test/integration/fixtures/blocks/core__cover.html b/test/integration/fixtures/blocks/core__cover.html index 8da6a870594839..7c19a4b1a3155a 100644 --- a/test/integration/fixtures/blocks/core__cover.html +++ b/test/integration/fixtures/blocks/core__cover.html @@ -1,13 +1,11 @@ - -
+ +
- +
-

- Guten Berg! -

- +

Cover!

+
diff --git a/test/integration/fixtures/blocks/core__cover.json b/test/integration/fixtures/blocks/core__cover.json index 0c55d2778cead8..e186455830870b 100644 --- a/test/integration/fixtures/blocks/core__cover.json +++ b/test/integration/fixtures/blocks/core__cover.json @@ -5,12 +5,13 @@ "isValid": true, "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", + "id": 6, "alt": "", "hasParallax": false, "isRepeated": false, "dimRatio": 40, "backgroundType": "image", - "isDark": true + "isDark": false }, "innerBlocks": [ { @@ -19,15 +20,15 @@ "isValid": true, "attributes": { "align": "center", - "content": "\n Guten Berg!\n ", + "content": "Cover!", "dropCap": false, "placeholder": "Write title…", "fontSize": "large" }, "innerBlocks": [], - "originalContent": "

\n Guten Berg!\n

" + "originalContent": "

Cover!

" } ], - "originalContent": "
\n \n \"\"\n
\n \n
\n
" + "originalContent": "
\n \n \"\"\n
\n \n
\n
" } ] diff --git a/test/integration/fixtures/blocks/core__cover.parsed.json b/test/integration/fixtures/blocks/core__cover.parsed.json index f90273321b52bb..f35697932d8786 100644 --- a/test/integration/fixtures/blocks/core__cover.parsed.json +++ b/test/integration/fixtures/blocks/core__cover.parsed.json @@ -3,7 +3,10 @@ "blockName": "core/cover", "attrs": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "dimRatio": 40 + "id": 6, + "dimRatio": 40, + "backgroundType": "image", + "isDark": false }, "innerBlocks": [ { @@ -14,15 +17,15 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n

\n Guten Berg!\n

\n ", + "innerHTML": "\n

Cover!

\n ", "innerContent": [ - "\n

\n Guten Berg!\n

\n " + "\n

Cover!

\n " ] } ], - "innerHTML": "\n
\n \n \"\"\n
\n \n
\n
\n", + "innerHTML": "\n
\n \n \"\"\n
\n \n
\n
\n", "innerContent": [ - "\n
\n \n \"\"\n
\n ", + "\n
\n \n \"\"\n
\n ", null, "\n
\n
\n" ] diff --git a/test/integration/fixtures/blocks/core__cover.serialized.html b/test/integration/fixtures/blocks/core__cover.serialized.html index 1e8377f99cafae..371900c2bf8da6 100644 --- a/test/integration/fixtures/blocks/core__cover.serialized.html +++ b/test/integration/fixtures/blocks/core__cover.serialized.html @@ -1,7 +1,5 @@ - -
-

- Guten Berg! -

+ +
+

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html index a8b4f46f37b16c..7322be047b6bda 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html @@ -1,4 +1,4 @@ - +

Cover Image

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html index eb9756f3e35a51..7a455d59010cd9 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html index 72db79ed9ebee3..0ec593a8e0a9ef 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html index 2507813b98cb3b..c9c50c2a52c08e 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html index 47ed576ca1716a..91f1f085795a5d 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html @@ -1,4 +1,4 @@ - +

Cover

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html index a63cb1375d2ea0..4f0883e89df952 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html @@ -1,4 +1,4 @@ - +

Guten Berg! @@ -6,13 +6,13 @@

- +

- +

test

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html index 0a5309cfd3012f..49aba594d27b49 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html @@ -1,4 +1,4 @@ - +

Guten Berg! diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.html b/test/integration/fixtures/blocks/core__cover__gradient-image.html index bd72d791a2a08e..94c334979d3591 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.html +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.html @@ -1,10 +1,10 @@ - -

- - + +
+ +
-

Cover!

+

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.json b/test/integration/fixtures/blocks/core__cover__gradient-image.json index b02fcb5caaca35..9129479d19028a 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.json @@ -5,13 +5,14 @@ "isValid": true, "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", + "id": 6, "alt": "", "hasParallax": false, "isRepeated": false, "dimRatio": 30, "backgroundType": "image", - "customGradient": "linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%)", - "isDark": true + "customGradient": "linear-gradient(201deg,rgb(255,245,203) 0%,rgb(182,227,212) 38%,rgb(51,167,181) 82%)", + "isDark": false }, "innerBlocks": [ { @@ -20,15 +21,15 @@ "isValid": true, "attributes": { "align": "center", - "content": " Cover! ", + "content": "Cover!", "dropCap": false, "placeholder": "Write title…", "fontSize": "large" }, "innerBlocks": [], - "originalContent": "

Cover!

" + "originalContent": "

Cover!

" } ], - "originalContent": "
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
" + "originalContent": "
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
" } ] diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json b/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json index e03c3b8cd41bb5..7b2ae43c6d8d19 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json @@ -3,8 +3,11 @@ "blockName": "core/cover", "attrs": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", + "id": 6, "dimRatio": 30, - "customGradient": "linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%)" + "backgroundType": "image", + "customGradient": "linear-gradient(201deg,rgb(255,245,203) 0%,rgb(182,227,212) 38%,rgb(51,167,181) 82%)", + "isDark": false }, "innerBlocks": [ { @@ -15,15 +18,15 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

Cover!

\n\t\t", + "innerHTML": "\n\t\t

Cover!

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

Cover!

\n\t\t" + "\n\t\t

Cover!

\n\t\t" ] } ], - "innerHTML": "\n
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
\n", + "innerHTML": "\n
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
\n", "innerContent": [ - "\n
\n\t\n\t\"\"\n\t
\n\t\t", + "\n
\n\t\n\t\"\"\n\t
\n\t\t", null, "\n\t
\n
\n" ] diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html b/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html index 6c07b2fe0952a8..794174a5e3c2ed 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html @@ -1,5 +1,5 @@ - -
-

Cover!

+ +
+

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__gradient.json b/test/integration/fixtures/blocks/core__cover__gradient.json index fd0e0f59dedcec..cf0de0c41a73fc 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.json @@ -8,7 +8,6 @@ "hasParallax": false, "isRepeated": false, "dimRatio": 100, - "backgroundType": "image", "customGradient": "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)", "isDark": true }, diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.json b/test/integration/fixtures/blocks/core__cover__solid-color.json index c170062fdb975d..f45eeef4201490 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.json @@ -9,7 +9,6 @@ "isRepeated": false, "dimRatio": 100, "overlayColor": "primary", - "backgroundType": "image", "isDark": true }, "innerBlocks": [ From 6a8348eb1aa8f6a37e87c5a39b28e1d60a05faac Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 19:23:03 +0100 Subject: [PATCH 05/10] Remove default dim ratio as it's derived from attributes --- packages/block-library/src/cover/block.json | 3 +-- packages/block-library/src/cover/edit.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index 69611d98aa214b..7f9ebcb8ac3998 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -29,8 +29,7 @@ "default": false }, "dimRatio": { - "type": "number", - "default": 100 + "type": "number" }, "overlayColor": { "type": "string" diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index 1187a4a00c0af8..92cff8ba99f869 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -402,7 +402,7 @@ function CoverEdit( { isImageBackground || isVideoBackground ? 50 : 100; setAttributes( { - dimRatio: dimRatio || defaultDimRatio, + dimRatio: 'number' === typeof dimRatio ? dimRatio : defaultDimRatio, } ); }, [ isImageBackground, isVideoBackground ] ); From 171783838a30f83e3abee29d4275955fe8ccbdf1 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 19:23:21 +0100 Subject: [PATCH 06/10] Regenerate fixtures again --- test/integration/fixtures/blocks/core__cover__gradient.html | 2 +- .../fixtures/blocks/core__cover__gradient.parsed.json | 1 + .../fixtures/blocks/core__cover__gradient.serialized.html | 2 +- test/integration/fixtures/blocks/core__cover__solid-color.html | 2 +- .../fixtures/blocks/core__cover__solid-color.parsed.json | 1 + .../fixtures/blocks/core__cover__solid-color.serialized.html | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/fixtures/blocks/core__cover__gradient.html b/test/integration/fixtures/blocks/core__cover__gradient.html index 8bd16152d5bb13..b59757cef5e54e 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.html +++ b/test/integration/fixtures/blocks/core__cover__gradient.html @@ -1,4 +1,4 @@ - +
diff --git a/test/integration/fixtures/blocks/core__cover__gradient.parsed.json b/test/integration/fixtures/blocks/core__cover__gradient.parsed.json index b0f8d37f9e5b44..8202990fce5970 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.parsed.json @@ -2,6 +2,7 @@ { "blockName": "core/cover", "attrs": { + "dimRatio": 100, "customGradient": "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)" }, "innerBlocks": [ diff --git a/test/integration/fixtures/blocks/core__cover__gradient.serialized.html b/test/integration/fixtures/blocks/core__cover__gradient.serialized.html index 31aedff636c24d..1875c35879cff2 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__gradient.serialized.html @@ -1,4 +1,4 @@ - +

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.html b/test/integration/fixtures/blocks/core__cover__solid-color.html index d08b70dfb3d791..7e8a15488125b6 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.html +++ b/test/integration/fixtures/blocks/core__cover__solid-color.html @@ -1,4 +1,4 @@ - +
diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json b/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json index 9be3bb3d0db3a9..012e672b8978ec 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json @@ -2,6 +2,7 @@ { "blockName": "core/cover", "attrs": { + "dimRatio": 100, "overlayColor": "primary" }, "innerBlocks": [ diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html b/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html index d8532c71201774..bc46ff3a5f5b45 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html @@ -1,4 +1,4 @@ - +

From 1877be3d02d929e8eca36dbe59c0a252c92dd5b5 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Thu, 11 Nov 2021 19:24:33 +0100 Subject: [PATCH 07/10] Add e2e test for dimmed background when transformed from Image --- .../specs/editor/blocks/cover.test.js | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/packages/e2e-tests/specs/editor/blocks/cover.test.js b/packages/e2e-tests/specs/editor/blocks/cover.test.js index 5026e84806b5ff..4cfbcdc955cd93 100644 --- a/packages/e2e-tests/specs/editor/blocks/cover.test.js +++ b/packages/e2e-tests/specs/editor/blocks/cover.test.js @@ -13,11 +13,13 @@ import { insertBlock, createNewPost, openDocumentSettingsSidebar, + transformBlockTo, } from '@wordpress/e2e-test-utils'; async function upload( selector ) { - await page.waitForSelector( selector ); - const inputElement = await page.$( selector ); + const inputElement = await page.waitForSelector( + `${ selector } input[type="file"]` + ); const testImagePath = path.join( __dirname, '..', @@ -30,9 +32,7 @@ async function upload( selector ) { const tmpFileName = path.join( os.tmpdir(), filename + '.png' ); fs.copyFileSync( testImagePath, tmpFileName ); await inputElement.uploadFile( tmpFileName ); - await page.waitForSelector( - `.wp-block-cover img[src$="${ filename }.png"]` - ); + await page.waitForSelector( `${ selector } img[src$="${ filename }.png"]` ); return filename; } @@ -68,9 +68,7 @@ describe( 'Cover', () => { it( 'can set background image using image upload on block placeholder', async () => { await insertBlock( 'Cover' ); // Create the block using uploaded image - const sourceImageFilename = await upload( - '.wp-block-cover input[type="file"]' - ); + const sourceImageFilename = await upload( '.wp-block-cover' ); // Get the block's background image URL const blockImage = await page.waitForSelector( '.wp-block-cover img' ); const blockImageUrl = await blockImage.evaluate( ( el ) => el.src ); @@ -81,7 +79,7 @@ describe( 'Cover', () => { it( 'dims background image down by 50% by default', async () => { await insertBlock( 'Cover' ); // Create the block using uploaded image - await upload( '.wp-block-cover input[type="file"]' ); + await upload( '.wp-block-cover' ); // Get the block's background dim color and its opacity const backgroundDim = await page.waitForSelector( '.wp-block-cover .has-background-dim' @@ -194,4 +192,26 @@ describe( 'Cover', () => { ) ).toBeGreaterThan( 100 ); } ); + + it( 'dims the background image down by 50% when transformed from the Image block', async () => { + await insertBlock( 'Image' ); + // Upload image and transform to the Cover block + await upload( '.wp-block-image' ); + await transformBlockTo( 'Cover' ); + + // Get the block's background dim color and its opacity + const backgroundDim = await page.waitForSelector( + '.wp-block-cover .has-background-dim' + ); + const [ + backgroundDimColor, + backgroundDimOpacity, + ] = await page.evaluate( ( el ) => { + const computedStyle = window.getComputedStyle( el ); + return [ computedStyle.backgroundColor, computedStyle.opacity ]; + }, backgroundDim ); + + expect( backgroundDimColor ).toBe( 'rgb(0, 0, 0)' ); + expect( backgroundDimOpacity ).toBe( '0.5' ); + } ); } ); From 025c7f19a8733475554a5d917279c17e12898d63 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Mon, 15 Nov 2021 17:08:36 +1300 Subject: [PATCH 08/10] Switch to using 'url' to detect if dimRatio should be 50 instead of undefaulting the backgroundType attribute --- packages/block-library/src/cover/block.json | 3 ++- packages/block-library/src/cover/edit.js | 13 +++++++++---- packages/block-library/src/cover/transforms.js | 1 - 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index 7f9ebcb8ac3998..e2f675e0216ded 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -38,7 +38,8 @@ "type": "string" }, "backgroundType": { - "type": "string" + "type": "string", + "default": "image" }, "focalPoint": { "type": "object" diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index 92cff8ba99f869..c29e7509313dc9 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -310,6 +310,7 @@ function CoverEdit( { setAttributes, setOverlayColor, toggleSelection, + markNextChangeAsNotPersistent, } ) { const { contentPosition, @@ -399,12 +400,12 @@ function CoverEdit( { useEffect( () => { const defaultDimRatio = - isImageBackground || isVideoBackground ? 50 : 100; - + ( isImageBackground || isVideoBackground ) && url ? 50 : 100; + markNextChangeAsNotPersistent(); setAttributes( { dimRatio: 'number' === typeof dimRatio ? dimRatio : defaultDimRatio, } ); - }, [ isImageBackground, isVideoBackground ] ); + }, [ isImageBackground, isVideoBackground, url, dimRatio ] ); const [ temporaryMinHeight, setTemporaryMinHeight ] = useState( null ); @@ -778,10 +779,14 @@ function CoverEdit( { export default compose( [ withDispatch( ( dispatch ) => { - const { toggleSelection } = dispatch( blockEditorStore ); + const { + toggleSelection, + __unstableMarkNextChangeAsNotPersistent, + } = dispatch( blockEditorStore ); return { toggleSelection, + markNextChangeAsNotPersistent: __unstableMarkNextChangeAsNotPersistent, }; } ), withColors( { overlayColor: 'background-color' } ), diff --git a/packages/block-library/src/cover/transforms.js b/packages/block-library/src/cover/transforms.js index f9447f0ee56ea9..bc480d497b2f81 100644 --- a/packages/block-library/src/cover/transforms.js +++ b/packages/block-library/src/cover/transforms.js @@ -17,7 +17,6 @@ const transforms = { createBlock( 'core/cover', { - backgroundType: IMAGE_BACKGROUND_TYPE, url, alt, align, From 65b52906fb446ec4cfa31c439b025c38bc27a07f Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 16 Nov 2021 10:08:48 +1300 Subject: [PATCH 09/10] Set the default dimRatio in the transformation instead of changing attribute defaults and setting in useEffect --- packages/block-library/src/cover/block.json | 3 ++- packages/block-library/src/cover/edit.js | 12 ------------ packages/block-library/src/cover/transforms.js | 2 ++ test/integration/fixtures/blocks/core__cover.html | 12 +++++++----- test/integration/fixtures/blocks/core__cover.json | 9 ++++----- .../fixtures/blocks/core__cover.parsed.json | 13 +++++-------- .../fixtures/blocks/core__cover.serialized.html | 8 +++++--- .../core__cover__deprecated-1.serialized.html | 2 +- .../core__cover__deprecated-2.serialized.html | 2 +- .../core__cover__deprecated-3.serialized.html | 2 +- .../core__cover__deprecated-4.serialized.html | 2 +- .../core__cover__deprecated-5.serialized.html | 2 +- .../core__cover__deprecated-6.serialized.html | 6 +++--- .../core__cover__deprecated-7.serialized.html | 2 +- .../blocks/core__cover__gradient-image.html | 10 +++++----- .../blocks/core__cover__gradient-image.json | 11 +++++------ .../blocks/core__cover__gradient-image.parsed.json | 13 +++++-------- .../core__cover__gradient-image.serialized.html | 6 +++--- .../fixtures/blocks/core__cover__gradient.html | 2 +- .../fixtures/blocks/core__cover__gradient.json | 1 + .../blocks/core__cover__gradient.parsed.json | 1 - .../blocks/core__cover__gradient.serialized.html | 2 +- .../fixtures/blocks/core__cover__solid-color.html | 2 +- .../fixtures/blocks/core__cover__solid-color.json | 1 + .../blocks/core__cover__solid-color.parsed.json | 1 - .../blocks/core__cover__solid-color.serialized.html | 2 +- 26 files changed, 58 insertions(+), 71 deletions(-) diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index e2f675e0216ded..852b9ab30d1c9b 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -29,7 +29,8 @@ "default": false }, "dimRatio": { - "type": "number" + "type": "number", + "default": 100 }, "overlayColor": { "type": "string" diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index c29e7509313dc9..414895a9765433 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -310,7 +310,6 @@ function CoverEdit( { setAttributes, setOverlayColor, toggleSelection, - markNextChangeAsNotPersistent, } ) { const { contentPosition, @@ -398,15 +397,6 @@ function CoverEdit( { const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType; const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType; - useEffect( () => { - const defaultDimRatio = - ( isImageBackground || isVideoBackground ) && url ? 50 : 100; - markNextChangeAsNotPersistent(); - setAttributes( { - dimRatio: 'number' === typeof dimRatio ? dimRatio : defaultDimRatio, - } ); - }, [ isImageBackground, isVideoBackground, url, dimRatio ] ); - const [ temporaryMinHeight, setTemporaryMinHeight ] = useState( null ); const minHeightWithUnit = minHeightUnit @@ -781,12 +771,10 @@ export default compose( [ withDispatch( ( dispatch ) => { const { toggleSelection, - __unstableMarkNextChangeAsNotPersistent, } = dispatch( blockEditorStore ); return { toggleSelection, - markNextChangeAsNotPersistent: __unstableMarkNextChangeAsNotPersistent, }; } ), withColors( { overlayColor: 'background-color' } ), diff --git a/packages/block-library/src/cover/transforms.js b/packages/block-library/src/cover/transforms.js index bc480d497b2f81..41a5aee957744b 100644 --- a/packages/block-library/src/cover/transforms.js +++ b/packages/block-library/src/cover/transforms.js @@ -17,6 +17,7 @@ const transforms = { createBlock( 'core/cover', { + dimRatio: 50, url, alt, align, @@ -43,6 +44,7 @@ const transforms = { createBlock( 'core/cover', { + dimRatio: 50, url: src, align, id, diff --git a/test/integration/fixtures/blocks/core__cover.html b/test/integration/fixtures/blocks/core__cover.html index 7c19a4b1a3155a..8da6a870594839 100644 --- a/test/integration/fixtures/blocks/core__cover.html +++ b/test/integration/fixtures/blocks/core__cover.html @@ -1,11 +1,13 @@ - -
+ +
- +
-

Cover!

- +

+ Guten Berg! +

+
diff --git a/test/integration/fixtures/blocks/core__cover.json b/test/integration/fixtures/blocks/core__cover.json index e186455830870b..0c55d2778cead8 100644 --- a/test/integration/fixtures/blocks/core__cover.json +++ b/test/integration/fixtures/blocks/core__cover.json @@ -5,13 +5,12 @@ "isValid": true, "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "id": 6, "alt": "", "hasParallax": false, "isRepeated": false, "dimRatio": 40, "backgroundType": "image", - "isDark": false + "isDark": true }, "innerBlocks": [ { @@ -20,15 +19,15 @@ "isValid": true, "attributes": { "align": "center", - "content": "Cover!", + "content": "\n Guten Berg!\n ", "dropCap": false, "placeholder": "Write title…", "fontSize": "large" }, "innerBlocks": [], - "originalContent": "

Cover!

" + "originalContent": "

\n Guten Berg!\n

" } ], - "originalContent": "
\n \n \"\"\n
\n \n
\n
" + "originalContent": "
\n \n \"\"\n
\n \n
\n
" } ] diff --git a/test/integration/fixtures/blocks/core__cover.parsed.json b/test/integration/fixtures/blocks/core__cover.parsed.json index f35697932d8786..f90273321b52bb 100644 --- a/test/integration/fixtures/blocks/core__cover.parsed.json +++ b/test/integration/fixtures/blocks/core__cover.parsed.json @@ -3,10 +3,7 @@ "blockName": "core/cover", "attrs": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "id": 6, - "dimRatio": 40, - "backgroundType": "image", - "isDark": false + "dimRatio": 40 }, "innerBlocks": [ { @@ -17,15 +14,15 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n

Cover!

\n ", + "innerHTML": "\n

\n Guten Berg!\n

\n ", "innerContent": [ - "\n

Cover!

\n " + "\n

\n Guten Berg!\n

\n " ] } ], - "innerHTML": "\n
\n \n \"\"\n
\n \n
\n
\n", + "innerHTML": "\n
\n \n \"\"\n
\n \n
\n
\n", "innerContent": [ - "\n
\n \n \"\"\n
\n ", + "\n
\n \n \"\"\n
\n ", null, "\n
\n
\n" ] diff --git a/test/integration/fixtures/blocks/core__cover.serialized.html b/test/integration/fixtures/blocks/core__cover.serialized.html index 371900c2bf8da6..1e8377f99cafae 100644 --- a/test/integration/fixtures/blocks/core__cover.serialized.html +++ b/test/integration/fixtures/blocks/core__cover.serialized.html @@ -1,5 +1,7 @@ - -
-

Cover!

+ +
+

+ Guten Berg! +

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html index 7322be047b6bda..a8b4f46f37b16c 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-1.serialized.html @@ -1,4 +1,4 @@ - +

Cover Image

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html index 7a455d59010cd9..eb9756f3e35a51 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-2.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html index 0ec593a8e0a9ef..72db79ed9ebee3 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-3.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html index c9c50c2a52c08e..2507813b98cb3b 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-4.serialized.html @@ -1,4 +1,4 @@ - +

Cover Block

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html index 91f1f085795a5d..47ed576ca1716a 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-5.serialized.html @@ -1,4 +1,4 @@ - +

Cover

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html index 4f0883e89df952..a63cb1375d2ea0 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-6.serialized.html @@ -1,4 +1,4 @@ - +

Guten Berg! @@ -6,13 +6,13 @@

- +

- +

test

diff --git a/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html b/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html index 49aba594d27b49..0a5309cfd3012f 100644 --- a/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__deprecated-7.serialized.html @@ -1,4 +1,4 @@ - +

Guten Berg! diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.html b/test/integration/fixtures/blocks/core__cover__gradient-image.html index 94c334979d3591..bd72d791a2a08e 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.html +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.html @@ -1,10 +1,10 @@ - -

- - + +
+ +
-

Cover!

+

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.json b/test/integration/fixtures/blocks/core__cover__gradient-image.json index 9129479d19028a..b02fcb5caaca35 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.json @@ -5,14 +5,13 @@ "isValid": true, "attributes": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "id": 6, "alt": "", "hasParallax": false, "isRepeated": false, "dimRatio": 30, "backgroundType": "image", - "customGradient": "linear-gradient(201deg,rgb(255,245,203) 0%,rgb(182,227,212) 38%,rgb(51,167,181) 82%)", - "isDark": false + "customGradient": "linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%)", + "isDark": true }, "innerBlocks": [ { @@ -21,15 +20,15 @@ "isValid": true, "attributes": { "align": "center", - "content": "Cover!", + "content": " Cover! ", "dropCap": false, "placeholder": "Write title…", "fontSize": "large" }, "innerBlocks": [], - "originalContent": "

Cover!

" + "originalContent": "

Cover!

" } ], - "originalContent": "
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
" + "originalContent": "
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
" } ] diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json b/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json index 7b2ae43c6d8d19..e03c3b8cd41bb5 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.parsed.json @@ -3,11 +3,8 @@ "blockName": "core/cover", "attrs": { "url": "data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=", - "id": 6, "dimRatio": 30, - "backgroundType": "image", - "customGradient": "linear-gradient(201deg,rgb(255,245,203) 0%,rgb(182,227,212) 38%,rgb(51,167,181) 82%)", - "isDark": false + "customGradient": "linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%)" }, "innerBlocks": [ { @@ -18,15 +15,15 @@ "fontSize": "large" }, "innerBlocks": [], - "innerHTML": "\n\t\t

Cover!

\n\t\t", + "innerHTML": "\n\t\t

Cover!

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

Cover!

\n\t\t" + "\n\t\t

Cover!

\n\t\t" ] } ], - "innerHTML": "\n
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
\n", + "innerHTML": "\n
\n\t\n\t\"\"\n\t
\n\t\t\n\t
\n
\n", "innerContent": [ - "\n
\n\t\n\t\"\"\n\t
\n\t\t", + "\n
\n\t\n\t\"\"\n\t
\n\t\t", null, "\n\t
\n
\n" ] diff --git a/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html b/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html index 794174a5e3c2ed..6c07b2fe0952a8 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__gradient-image.serialized.html @@ -1,5 +1,5 @@ - -
-

Cover!

+ +
+

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__gradient.html b/test/integration/fixtures/blocks/core__cover__gradient.html index b59757cef5e54e..8bd16152d5bb13 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.html +++ b/test/integration/fixtures/blocks/core__cover__gradient.html @@ -1,4 +1,4 @@ - +
diff --git a/test/integration/fixtures/blocks/core__cover__gradient.json b/test/integration/fixtures/blocks/core__cover__gradient.json index cf0de0c41a73fc..fd0e0f59dedcec 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.json @@ -8,6 +8,7 @@ "hasParallax": false, "isRepeated": false, "dimRatio": 100, + "backgroundType": "image", "customGradient": "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)", "isDark": true }, diff --git a/test/integration/fixtures/blocks/core__cover__gradient.parsed.json b/test/integration/fixtures/blocks/core__cover__gradient.parsed.json index 8202990fce5970..b0f8d37f9e5b44 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__gradient.parsed.json @@ -2,7 +2,6 @@ { "blockName": "core/cover", "attrs": { - "dimRatio": 100, "customGradient": "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)" }, "innerBlocks": [ diff --git a/test/integration/fixtures/blocks/core__cover__gradient.serialized.html b/test/integration/fixtures/blocks/core__cover__gradient.serialized.html index 1875c35879cff2..31aedff636c24d 100644 --- a/test/integration/fixtures/blocks/core__cover__gradient.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__gradient.serialized.html @@ -1,4 +1,4 @@ - +

Cover!

diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.html b/test/integration/fixtures/blocks/core__cover__solid-color.html index 7e8a15488125b6..d08b70dfb3d791 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.html +++ b/test/integration/fixtures/blocks/core__cover__solid-color.html @@ -1,4 +1,4 @@ - +
diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.json b/test/integration/fixtures/blocks/core__cover__solid-color.json index f45eeef4201490..c170062fdb975d 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.json @@ -9,6 +9,7 @@ "isRepeated": false, "dimRatio": 100, "overlayColor": "primary", + "backgroundType": "image", "isDark": true }, "innerBlocks": [ diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json b/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json index 012e672b8978ec..9be3bb3d0db3a9 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json +++ b/test/integration/fixtures/blocks/core__cover__solid-color.parsed.json @@ -2,7 +2,6 @@ { "blockName": "core/cover", "attrs": { - "dimRatio": 100, "overlayColor": "primary" }, "innerBlocks": [ diff --git a/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html b/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html index bc46ff3a5f5b45..d8532c71201774 100644 --- a/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html +++ b/test/integration/fixtures/blocks/core__cover__solid-color.serialized.html @@ -1,4 +1,4 @@ - +

From 173e983a2d536ecd8ff6b765f2794cf5e040cfc3 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 16 Nov 2021 10:09:17 +1300 Subject: [PATCH 10/10] Linting fix --- packages/block-library/src/cover/edit.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index 414895a9765433..f057a2b56291fc 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -769,9 +769,7 @@ function CoverEdit( { export default compose( [ withDispatch( ( dispatch ) => { - const { - toggleSelection, - } = dispatch( blockEditorStore ); + const { toggleSelection } = dispatch( blockEditorStore ); return { toggleSelection,