Make WordPress Core

Changeset 53261


Ignore:
Timestamp:
04/25/2022 04:55:45 PM (2 years ago)
Author:
gziolo
Message:

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.

Location:
trunk/tests/phpunit/data/blocks/fixtures
Files:
10 edited

Legend:

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

    r46587 r53261  
    1 <!-- wp:core/gallery -->
    2 <ul class="wp-block-gallery columns-2 is-cropped">
    3     <li class="blocks-gallery-item">
    4         <figure>
    5             <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" />
    6         </figure>
    7     </li>
    8     <li class="blocks-gallery-item">
    9         <figure>
    10             <img src="http://google.com/hi.png" alt="title" />
    11         </figure>
    12     </li>
    13 </ul>
    14 <!-- /wp:core/gallery -->
     1<!-- wp:gallery {"linkTo":"none","className":"columns-2"} -->
     2<figure class="wp-block-gallery has-nested-images columns-default is-cropped columns-2">
     3    <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
     4    <figure class="wp-block-image size-large">
     5        <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" />
     6    </figure>
     7    <!-- /wp:image -->
     8
     9    <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
     10    <figure class="wp-block-image size-large">
     11        <img src="http://google.com/hi.png" alt="Image gallery image" />
     12    </figure>
     13    <!-- /wp:image -->
     14</figure>
     15<!-- /wp:gallery -->
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery.json

    r46587 r53261  
    11[
    2     {
    3         "clientId": "_clientId_0",
    4         "name": "core/gallery",
    5         "isValid": true,
    6         "attributes": {
    7             "images": [
    8                 {
    9                     "url": "https://cldup.com/uuUqE_dXzy.jpg",
    10                     "alt": "title",
    11                     "caption": ""
    12                 },
    13                 {
    14                     "url": "http://google.com/hi.png",
    15                     "alt": "title",
    16                     "caption": ""
    17                 }
    18             ],
    19             "imageCrop": true,
    20             "linkTo": "none"
    21         },
    22         "innerBlocks": [],
    23         "originalContent": "<ul class=\"wp-block-gallery columns-2 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>"
    24     }
     2    {
     3        "name": "core/gallery",
     4        "isValid": true,
     5        "attributes": {
     6            "images": [],
     7            "ids": [],
     8            "shortCodeTransforms": [],
     9            "caption": "",
     10            "imageCrop": true,
     11            "fixedHeight": true,
     12            "linkTo": "none",
     13            "sizeSlug": "large",
     14            "allowResize": false,
     15            "className": "columns-2"
     16        },
     17        "innerBlocks": [
     18            {
     19                "name": "core/image",
     20                "isValid": true,
     21                "attributes": {
     22                    "url": "https://cldup.com/uuUqE_dXzy.jpg",
     23                    "alt": "Image gallery image",
     24                    "caption": "",
     25                    "sizeSlug": "large",
     26                    "linkDestination": "none"
     27                },
     28                "innerBlocks": []
     29            },
     30            {
     31                "name": "core/image",
     32                "isValid": true,
     33                "attributes": {
     34                    "url": "http://google.com/hi.png",
     35                    "alt": "Image gallery image",
     36                    "caption": "",
     37                    "sizeSlug": "large",
     38                    "linkDestination": "none"
     39                },
     40                "innerBlocks": []
     41            }
     42        ]
     43    }
    2544]
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery.parsed.json

    r46587 r53261  
    11[
    2     {
    3         "blockName": "core/gallery",
    4         "attrs": {},
    5         "innerBlocks": [],
    6         "innerHTML": "\n<ul class=\"wp-block-gallery columns-2 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>\n",
    7         "innerContent": [
    8             "\n<ul class=\"wp-block-gallery columns-2 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>\n"
    9         ]
    10     },
     2    {
     3        "blockName": "core/gallery",
     4        "attrs": {
     5            "linkTo": "none",
     6            "className": "columns-2"
     7        },
     8        "innerBlocks": [
     9            {
     10                "blockName": "core/image",
     11                "attrs": {
     12                    "sizeSlug": "large",
     13                    "linkDestination": "none"
     14                },
     15                "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                "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                ]
     20            },
     21            {
     22                "blockName": "core/image",
     23                "attrs": {
     24                    "sizeSlug": "large",
     25                    "linkDestination": "none"
     26                },
     27                "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",
     29                "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"
     31                ]
     32            }
     33        ],
     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",
     35        "innerContent": [
     36            "\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped columns-2\">\n\t",
     37            null,
     38            "\n\n\t",
     39            null,
     40            "\n</figure>\n"
     41        ]
     42    },
    1143    {
    1244        "blockName": null,
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery.serialized.html

    r46587 r53261  
    1 <!-- wp:gallery -->
    2 <ul class="wp-block-gallery columns-2 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="http://google.com/hi.png" alt="title"/></figure></li></ul>
     1<!-- wp:gallery {"linkTo":"none","className":"columns-2"} -->
     2<figure class="wp-block-gallery has-nested-images columns-default is-cropped columns-2"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" /></figure><!-- /wp:image --><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="http://google.com/hi.png" alt="Image gallery image" /></figure><!-- /wp:image --></figure>
    33<!-- /wp:gallery -->
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery.server.html

    r53157 r53261  
    11
    2 <ul class="wp-container-1 wp-block-gallery-1 wp-block-gallery columns-2 is-cropped">
    3     <li class="blocks-gallery-item">
    4         <figure>
    5             <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" />
    6         </figure>
    7     </li>
    8     <li class="blocks-gallery-item">
    9         <figure>
    10             <img src="http://google.com/hi.png" alt="title" />
    11         </figure>
    12     </li>
    13 </ul>
     2<figure class="wp-container-1 wp-block-gallery-1 wp-block-gallery has-nested-images columns-default is-cropped columns-2">
     3   
     4    <figure class="wp-block-image size-large">
     5        <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" />
     6    </figure>
     7   
    148
     9   
     10    <figure class="wp-block-image size-large">
     11        <img src="http://google.com/hi.png" alt="Image gallery image" />
     12    </figure>
     13   
     14</figure>
     15
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery__columns.html

    r46587 r53261  
    1 <!-- wp:core/gallery {"columns":1} -->
    2 <ul class="wp-block-gallery columns-1 is-cropped">
    3     <li class="blocks-gallery-item">
    4         <figure>
    5             <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" />
    6         </figure>
    7     </li>
    8     <li class="blocks-gallery-item">
    9         <figure>
    10             <img src="http://google.com/hi.png" alt="title" />
    11         </figure>
    12     </li>
    13 </ul>
    14 <!-- /wp:core/gallery -->
     1<!-- wp:gallery {"linkTo":"none","className":"columns-1"} -->
     2<figure class="wp-block-gallery has-nested-images is-cropped columns-1" >
     3    <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
     4    <figure class="wp-block-image size-large">
     5        <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" />
     6    </figure>
     7    <!-- /wp:image -->
     8
     9    <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
     10    <figure class="wp-block-image size-large">
     11        <img src="http://google.com/hi.png" alt="Image gallery image" />
     12    </figure>
     13    <!-- /wp:image -->
     14</figure>
     15<!-- /wp:gallery -->
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery__columns.json

    r46587 r53261  
    11[
    2     {
    3         "clientId": "_clientId_0",
    4         "name": "core/gallery",
    5         "isValid": true,
    6         "attributes": {
    7             "images": [
    8                 {
    9                     "url": "https://cldup.com/uuUqE_dXzy.jpg",
    10                     "alt": "title",
    11                     "caption": ""
    12                 },
    13                 {
    14                     "url": "http://google.com/hi.png",
    15                     "alt": "title",
    16                     "caption": ""
    17                 }
    18             ],
    19             "columns": 1,
    20             "imageCrop": true,
    21             "linkTo": "none"
    22         },
    23         "innerBlocks": [],
    24         "originalContent": "<ul class=\"wp-block-gallery columns-1 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>"
    25     }
     2    {
     3        "name": "core/gallery",
     4        "isValid": true,
     5        "attributes": {
     6            "images": [],
     7            "ids": [],
     8            "shortCodeTransforms": [],
     9            "caption": "",
     10            "imageCrop": true,
     11            "fixedHeight": true,
     12            "linkTo": "none",
     13            "sizeSlug": "large",
     14            "allowResize": false,
     15            "className": "columns-1",
     16            "columns": 1
     17        },
     18        "innerBlocks": [
     19            {
     20                "name": "core/image",
     21                "isValid": true,
     22                "attributes": {
     23                    "url": "https://cldup.com/uuUqE_dXzy.jpg",
     24                    "alt": "Image gallery image",
     25                    "caption": "",
     26                    "sizeSlug": "large",
     27                    "linkDestination": "none"
     28                },
     29                "innerBlocks": []
     30            },
     31            {
     32                "name": "core/image",
     33                "isValid": true,
     34                "attributes": {
     35                    "url": "http://google.com/hi.png",
     36                    "alt": "Image gallery image",
     37                    "caption": "",
     38                    "sizeSlug": "large",
     39                    "linkDestination": "none"
     40                },
     41                "innerBlocks": []
     42            }
     43        ]
     44    }
    2645]
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery__columns.parsed.json

    r46587 r53261  
    11[
    2     {
    3         "blockName": "core/gallery",
    4         "attrs": {
    5             "columns": 1
    6         },
    7         "innerBlocks": [],
    8         "innerHTML": "\n<ul class=\"wp-block-gallery columns-1 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>\n",
    9         "innerContent": [
    10             "\n<ul class=\"wp-block-gallery columns-1 is-cropped\">\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n\t<li class=\"blocks-gallery-item\">\n\t\t<figure>\n\t\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t\t</figure>\n\t</li>\n</ul>\n"
    11         ]
    12     },
     2    {
     3        "blockName": "core/gallery",
     4        "attrs": {
     5            "linkTo": "none",
     6            "className": "columns-1"
     7        },
     8        "innerBlocks": [
     9            {
     10                "blockName": "core/image",
     11                "attrs": {
     12                    "sizeSlug": "large",
     13                    "linkDestination": "none"
     14                },
     15                "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                "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                ]
     20            },
     21            {
     22                "blockName": "core/image",
     23                "attrs": {
     24                    "sizeSlug": "large",
     25                    "linkDestination": "none"
     26                },
     27                "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",
     29                "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"
     31                ]
     32            }
     33        ],
     34        "innerHTML": "\n<figure class=\"wp-block-gallery has-nested-images is-cropped columns-1\" >\n\t\n\n\t\n</figure>\n",
     35        "innerContent": [
     36            "\n<figure class=\"wp-block-gallery has-nested-images is-cropped columns-1\" >\n\t",
     37            null,
     38            "\n\n\t",
     39            null,
     40            "\n</figure>\n"
     41        ]
     42    },
    1343    {
    1444        "blockName": null,
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery__columns.serialized.html

    r46587 r53261  
    1 <!-- wp:gallery {"columns":1} -->
    2 <ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title"/></figure></li><li class="blocks-gallery-item"><figure><img src="http://google.com/hi.png" alt="title"/></figure></li></ul>
     1<!-- wp:gallery {"linkTo":"none","className":"columns-1"} -->
     2<figure class="wp-block-gallery has-nested-images is-cropped columns-1"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" /></figure><!-- /wp:image --><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="http://google.com/hi.png" alt="Image gallery image" /></figure><!-- /wp:image --></figure>
    33<!-- /wp:gallery -->
  • trunk/tests/phpunit/data/blocks/fixtures/core__gallery__columns.server.html

    r53157 r53261  
    11
    2 <ul class="wp-container-1 wp-block-gallery-1 wp-block-gallery columns-1 is-cropped">
    3     <li class="blocks-gallery-item">
    4         <figure>
    5             <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" />
    6         </figure>
    7     </li>
    8     <li class="blocks-gallery-item">
    9         <figure>
    10             <img src="http://google.com/hi.png" alt="title" />
    11         </figure>
    12     </li>
    13 </ul>
     2<figure class="wp-container-1 wp-block-gallery-1 wp-block-gallery has-nested-images is-cropped columns-1" >
     3   
     4    <figure class="wp-block-image size-large">
     5        <img src="https://cldup.com/uuUqE_dXzy.jpg" alt="Image gallery image" />
     6    </figure>
     7   
    148
     9   
     10    <figure class="wp-block-image size-large">
     11        <img src="http://google.com/hi.png" alt="Image gallery image" />
     12    </figure>
     13   
     14</figure>
     15
Note: See TracChangeset for help on using the changeset viewer.