From 3cc94be23b31d8eb22c81a615b749f82bd6de2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=83=C2=B3=C3=85=E2=80=9Akowski?= Date: Mon, 25 Apr 2022 16:55:45 +0000 Subject: [PATCH] Tests: Update Gallery block unit tests to new gallery format The Gallery block unit tests still use the old format, so this updates it to the new format that uses nested Image blocks. Props glendaviesnz. Fixes #55571. git-svn-id: https://develop.svn.wordpress.org/trunk@53261 602fd350-edb4-49c9-b593-d223f7449a82 --- .../data/blocks/fixtures/core__gallery.html | 29 ++++---- .../data/blocks/fixtures/core__gallery.json | 65 +++++++++++------- .../blocks/fixtures/core__gallery.parsed.json | 52 +++++++++++--- .../fixtures/core__gallery.serialized.html | 6 +- .../blocks/fixtures/core__gallery.server.html | 25 +++---- .../fixtures/core__gallery__columns.html | 29 ++++---- .../fixtures/core__gallery__columns.json | 67 ++++++++++++------- .../core__gallery__columns.parsed.json | 54 +++++++++++---- .../core__gallery__columns.serialized.html | 6 +- .../core__gallery__columns.server.html | 25 +++---- 10 files changed, 231 insertions(+), 127 deletions(-) diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery.html b/tests/phpunit/data/blocks/fixtures/core__gallery.html index 5e48c7e663..54f9991f88 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery.html @@ -1,14 +1,15 @@ - - - + + + diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery.json b/tests/phpunit/data/blocks/fixtures/core__gallery.json index 8cfcc26d3b..0225422123 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery.json +++ b/tests/phpunit/data/blocks/fixtures/core__gallery.json @@ -1,25 +1,44 @@ [ - { - "clientId": "_clientId_0", - "name": "core/gallery", - "isValid": true, - "attributes": { - "images": [ - { - "url": "https://cldup.com/uuUqE_dXzy.jpg", - "alt": "title", - "caption": "" - }, - { - "url": "http://google.com/hi.png", - "alt": "title", - "caption": "" - } - ], - "imageCrop": true, - "linkTo": "none" - }, - "innerBlocks": [], - "originalContent": "" - } + { + "name": "core/gallery", + "isValid": true, + "attributes": { + "images": [], + "ids": [], + "shortCodeTransforms": [], + "caption": "", + "imageCrop": true, + "fixedHeight": true, + "linkTo": "none", + "sizeSlug": "large", + "allowResize": false, + "className": "columns-2" + }, + "innerBlocks": [ + { + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "alt": "Image gallery image", + "caption": "", + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [] + }, + { + "name": "core/image", + "isValid": true, + "attributes": { + "url": "http://google.com/hi.png", + "alt": "Image gallery image", + "caption": "", + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [] + } + ] + } ] diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json b/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json index fc5c9e17d6..00a75f5f13 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json +++ b/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json @@ -1,13 +1,45 @@ [ - { - "blockName": "core/gallery", - "attrs": {}, - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": [ - "\n\n" - ] - }, + { + "blockName": "core/gallery", + "attrs": { + "linkTo": "none", + "className": "columns-2" + }, + "innerBlocks": [ + { + "blockName": "core/image", + "attrs": { + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t
\n\t\t\"Image\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t\"Image\n\t
\n\t" + ] + }, + { + "blockName": "core/image", + "attrs": { + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t
\n\t\t\"Image\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t\"Image\n\t
\n\t" + ] + } + ], + "innerHTML": "\n\n", + "innerContent": [ + "\n\n" + ] + }, { "blockName": null, "attrs": {}, @@ -17,4 +49,4 @@ "\n" ] } -] +] \ No newline at end of file diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery.serialized.html b/tests/phpunit/data/blocks/fixtures/core__gallery.serialized.html index 5bf6ce819f..bc5d6be414 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery.serialized.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery.serialized.html @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery.server.html b/tests/phpunit/data/blocks/fixtures/core__gallery.server.html index 21ddbc9489..a185c67cd7 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery.server.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery.server.html @@ -1,14 +1,15 @@ - + diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.html b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.html index cf1f1bb43f..4f34167c17 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.html @@ -1,14 +1,15 @@ - - - + + + diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.json b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.json index b3daaa05f6..4523d16b20 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.json +++ b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.json @@ -1,26 +1,45 @@ [ - { - "clientId": "_clientId_0", - "name": "core/gallery", - "isValid": true, - "attributes": { - "images": [ - { - "url": "https://cldup.com/uuUqE_dXzy.jpg", - "alt": "title", - "caption": "" - }, - { - "url": "http://google.com/hi.png", - "alt": "title", - "caption": "" - } - ], - "columns": 1, - "imageCrop": true, - "linkTo": "none" - }, - "innerBlocks": [], - "originalContent": "" - } + { + "name": "core/gallery", + "isValid": true, + "attributes": { + "images": [], + "ids": [], + "shortCodeTransforms": [], + "caption": "", + "imageCrop": true, + "fixedHeight": true, + "linkTo": "none", + "sizeSlug": "large", + "allowResize": false, + "className": "columns-1", + "columns": 1 + }, + "innerBlocks": [ + { + "name": "core/image", + "isValid": true, + "attributes": { + "url": "https://cldup.com/uuUqE_dXzy.jpg", + "alt": "Image gallery image", + "caption": "", + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [] + }, + { + "name": "core/image", + "isValid": true, + "attributes": { + "url": "http://google.com/hi.png", + "alt": "Image gallery image", + "caption": "", + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [] + } + ] + } ] diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.parsed.json b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.parsed.json index 6f6e4b856d..d3d7c23893 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.parsed.json +++ b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.parsed.json @@ -1,15 +1,45 @@ [ - { - "blockName": "core/gallery", - "attrs": { - "columns": 1 - }, - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": [ - "\n\n" - ] - }, + { + "blockName": "core/gallery", + "attrs": { + "linkTo": "none", + "className": "columns-1" + }, + "innerBlocks": [ + { + "blockName": "core/image", + "attrs": { + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t
\n\t\t\"Image\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t\"Image\n\t
\n\t" + ] + }, + { + "blockName": "core/image", + "attrs": { + "sizeSlug": "large", + "linkDestination": "none" + }, + "innerBlocks": [], + "innerHTML": "\n\t
\n\t\t\"Image\n\t
\n\t", + "innerContent": [ + "\n\t
\n\t\t\"Image\n\t
\n\t" + ] + } + ], + "innerHTML": "\n\n", + "innerContent": [ + "\n\n" + ] + }, { "blockName": null, "attrs": {}, @@ -19,4 +49,4 @@ "\n" ] } -] +] \ No newline at end of file diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.serialized.html b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.serialized.html index 183e484ec4..88464bedce 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.serialized.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.serialized.html @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file diff --git a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.server.html b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.server.html index 9460b2e09e..4056203589 100644 --- a/tests/phpunit/data/blocks/fixtures/core__gallery__columns.server.html +++ b/tests/phpunit/data/blocks/fixtures/core__gallery__columns.server.html @@ -1,14 +1,15 @@ - +