Make WordPress Core


Ignore:
Timestamp:
03/07/2023 05:46:16 AM (20 months ago)
Author:
peterwilsoncc
Message:

Build/Tests Tools: Add unit tests for Gallery blocks.

Introduces unit tests for the following blocks

  • Gallery block with caption
  • Gallery block, deprecations 1 thru 7

Updates the unit tests for the following blocks to match the counterparts stored in the Gutenberg repository:

  • Gallery block
  • Gallery block with columns

Modifies Tests_Blocks_Render::test_do_block_output() to ignore white space at the end of lines to account for whitespace equivalence in HTML.

Props peterwilsoncc, isabel_brison, gziolo.
Fixes #55571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json

    r53261 r55471  
    1010                "blockName": "core/image",
    1111                "attrs": {
     12                    "id": 1421,
    1213                    "sizeSlug": "large",
    1314                    "linkDestination": "none"
    1415                },
    1516                "innerBlocks": [],
    16                 "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"Image gallery image\" />\n\t</figure>\n\t",
     17                "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t",
    1718                "innerContent": [
    18                     "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"Image gallery image\" />\n\t</figure>\n\t"
     19                    "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2016/09/cropped-img_9054-1.jpg?w=190\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1421\"\n\t\t/>\n\t</figure>\n\t"
    1920                ]
    2021            },
     
    2223                "blockName": "core/image",
    2324                "attrs": {
     25                    "id": 1440,
    2426                    "sizeSlug": "large",
    2527                    "linkDestination": "none"
    2628                },
    2729                "innerBlocks": [],
    28                 "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img src=\"http://google.com/hi.png\" alt=\"Image gallery image\" />\n\t</figure>\n\t",
     30                "innerHTML": "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t",
    2931                "innerContent": [
    30                     "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img src=\"http://google.com/hi.png\" alt=\"Image gallery image\" />\n\t</figure>\n\t"
     32                    "\n\t<figure class=\"wp-block-image size-large\">\n\t\t<img\n\t\t\tsrc=\"https://sergioestevaofolio.files.wordpress.com/2017/09/cropped-l1001498-1.jpg?w=580\"\n\t\t\talt=\"Image gallery image\"\n\t\t\tclass=\"wp-image-1440\"\n\t\t/>\n\t</figure>\n\t"
    3133                ]
    3234            }
    3335        ],
    34         "innerHTML": "\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\">\n\t\n\n\t\n</figure>\n",
     36        "innerHTML": "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t\n\n\t\n</figure>\n",
    3537        "innerContent": [
    36             "\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\">\n\t",
     38            "\n<figure\n\tclass=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\"\n>\n\t",
    3739            null,
    3840            "\n\n\t",
     
    4143        ]
    4244    },
    43     {
    44         "blockName": null,
    45         "attrs": {},
    46         "innerBlocks": [],
    47         "innerHTML": "\n",
    48         "innerContent": [
    49             "\n"
    50         ]
    51     }
     45    {
     46        "blockName": null,
     47        "attrs": {},
     48        "innerBlocks": [],
     49        "innerHTML": "\n",
     50        "innerContent": [ "\n" ]
     51    }
     52
    5253]
Note: See TracChangeset for help on using the changeset viewer.