Make WordPress Core


Ignore:
Timestamp:
03/07/2023 05:46:16 AM (3 years 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__columns.parsed.json

    r53261 r55471  
    33                "blockName": "core/gallery",
    44                "attrs": {
    5                         "linkTo": "none",
    6                         "className": "columns-1"
     5                        "columns": 1,
     6                        "linkTo": "none"
    77                },
    88                "innerBlocks": [
     
    1010                                "blockName": "core/image",
    1111                                "attrs": {
     12                                        "id": 1421,
    1213                                        "sizeSlug": "large",
    13                                         "linkDestination": "none"
     14                                        "linkDestination": "none",
     15                                        "inheritedAttributes": {
     16                                                "linkDestination": true,
     17                                                "linkTarget": true,
     18                                                "sizeSlug": true
     19                                        }
    1420                                },
    1521                                "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",
     22                                "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",
    1723                                "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"
     24                                        "\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"
    1925                                ]
    2026                        },
     
    2228                                "blockName": "core/image",
    2329                                "attrs": {
     30                                        "id": 1440,
    2431                                        "sizeSlug": "large",
    25                                         "linkDestination": "none"
     32                                        "linkDestination": "none",
     33                                        "inheritedAttributes": {
     34                                                "linkDestination": true,
     35                                                "linkTarget": true,
     36                                                "sizeSlug": true
     37                                        }
    2638                                },
    2739                                "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",
     40                                "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",
    2941                                "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"
     42                                        "\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"
    3143                                ]
    3244                        }
    3345                ],
    34                 "innerHTML": "\n<figure class=\"wp-block-gallery has-nested-images is-cropped columns-1\" >\n\t\n\n\t\n</figure>\n",
     46                "innerHTML": "\n<figure class=\"wp-block-gallery has-nested-images columns-1 is-cropped\">\n\t\n\n\t\n</figure>\n",
    3547                "innerContent": [
    36                         "\n<figure class=\"wp-block-gallery has-nested-images is-cropped columns-1\" >\n\t",
     48                        "\n<figure class=\"wp-block-gallery has-nested-images columns-1 is-cropped\">\n\t",
    3749                        null,
    3850                        "\n\n\t",
     
    4153                ]
    4254        },
    43     {
    44         "blockName": null,
    45         "attrs": {},
    46         "innerBlocks": [],
    47         "innerHTML": "\n",
    48         "innerContent": [
    49             "\n"
    50         ]
    51     }
     55        {
     56                "blockName": null,
     57                "attrs": {},
     58                "innerBlocks": [],
     59                "innerHTML": "\n",
     60                "innerContent": [ "\n" ]
     61        }
    5262]
Note: See TracChangeset for help on using the changeset viewer.