From eab53ef5a2bd8065ff23da274784696d24d952df Mon Sep 17 00:00:00 2001 From: Miguel Fonseca Date: Fri, 29 Sep 2017 16:13:41 +0100 Subject: [PATCH] Cover Image: Ensure backcompat via default attributes --- blocks/library/cover-image/index.js | 4 ++-- blocks/library/cover-image/style.scss | 2 +- blocks/test/fixtures/core__cover-image.html | 4 ++-- blocks/test/fixtures/core__cover-image.json | 4 ++-- blocks/test/fixtures/core__cover-image.parsed.json | 4 ++-- blocks/test/fixtures/core__cover-image.serialized.html | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blocks/library/cover-image/index.js b/blocks/library/cover-image/index.js index b990b3c87c6ea9..d5abf2b7354695 100644 --- a/blocks/library/cover-image/index.js +++ b/blocks/library/cover-image/index.js @@ -51,7 +51,7 @@ registerBlockType( 'core/cover-image', { }, dimRatio: { type: 'number', - default: 0, + default: 50, }, }, @@ -191,7 +191,7 @@ registerBlockType( 'core/cover-image', { } ); function dimRatioToClass( ratio ) { - return ratio === 0 + return ( ratio === 0 || ratio === 50 ) ? null : 'has-background-dim-' + Math.round( ratio / 10 ); } diff --git a/blocks/library/cover-image/style.scss b/blocks/library/cover-image/style.scss index fb58c208ff24e4..24f5e347f102c9 100644 --- a/blocks/library/cover-image/style.scss +++ b/blocks/library/cover-image/style.scss @@ -29,7 +29,7 @@ left: 0; bottom: 0; right: 0; - background: rgba( black, 0 ); + background: rgba( black, 0.5 ); } @for $i from 1 through 10 { diff --git a/blocks/test/fixtures/core__cover-image.html b/blocks/test/fixtures/core__cover-image.html index a820a911db2a3c..1a5835852dbb7c 100644 --- a/blocks/test/fixtures/core__cover-image.html +++ b/blocks/test/fixtures/core__cover-image.html @@ -1,5 +1,5 @@ - -
+ +

Guten Berg!

diff --git a/blocks/test/fixtures/core__cover-image.json b/blocks/test/fixtures/core__cover-image.json index 4d8d9f3b3d56b5..35f3566c0290be 100644 --- a/blocks/test/fixtures/core__cover-image.json +++ b/blocks/test/fixtures/core__cover-image.json @@ -9,8 +9,8 @@ ], "url": "https://cldup.com/uuUqE_dXzy.jpg", "hasParallax": false, - "dimRatio": 50 + "dimRatio": 40 }, - "originalContent": "
\n

Guten Berg!

\n
" + "originalContent": "
\n

Guten Berg!

\n
" } ] diff --git a/blocks/test/fixtures/core__cover-image.parsed.json b/blocks/test/fixtures/core__cover-image.parsed.json index cc7cf85610a4a2..70ad0a76af4c0e 100644 --- a/blocks/test/fixtures/core__cover-image.parsed.json +++ b/blocks/test/fixtures/core__cover-image.parsed.json @@ -3,9 +3,9 @@ "blockName": "core/cover-image", "attrs": { "url": "https://cldup.com/uuUqE_dXzy.jpg", - "dimRatio": 50 + "dimRatio": 40 }, - "rawContent": "\n
\n

Guten Berg!

\n
\n" + "rawContent": "\n
\n

Guten Berg!

\n
\n" }, { "attrs": {}, diff --git a/blocks/test/fixtures/core__cover-image.serialized.html b/blocks/test/fixtures/core__cover-image.serialized.html index a820a911db2a3c..1a5835852dbb7c 100644 --- a/blocks/test/fixtures/core__cover-image.serialized.html +++ b/blocks/test/fixtures/core__cover-image.serialized.html @@ -1,5 +1,5 @@ - -
+ +

Guten Berg!