Make WordPress Core


Ignore:
Timestamp:
09/26/2022 02:56:41 PM (2 years ago)
Author:
hellofromTonya
Message:

Editor: Fix spacing property generation in flow layout type.

Fixes a bug of invalid CSS value when applying block spacing to a block as reported in Gutenberg issue 44435.

Adds logic to convert preset values (i.e. $gap_value) into valid CSS custom properties for the flow ('default') layout type. See the original fix in Gutenberg PR 3324.

Also adds a test dataset that fails before the bugfix and passes after the bugix.

Follow-up to [54274].

Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya.
See #56467.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-supports/wpGetLayoutStyle.php

    r54274 r54311  
    249249                'expected_output' => '.wp-layout{flex-wrap:nowrap;flex-direction:column;align-items:flex-start;}',
    250250            ),
     251            'default layout with blockGap to verify converting gap value into valid CSS' => array(
     252                'args'            => array(
     253                    'selector'              => '.wp-block-group.wp-container-6',
     254                    'layout'                => array(
     255                        'type' => 'default',
     256                    ),
     257                    'has_block_gap_support' => true,
     258                    'gap_value'             => 'var:preset|spacing|70',
     259                    'block_spacing'         => array(
     260                        'blockGap' => 'var(--wp--preset--spacing--70)',
     261                    ),
     262                ),
     263                'expected_output' => '.wp-block-group.wp-container-6 > *{margin-block-start:0;margin-block-end:0;}.wp-block-group.wp-container-6.wp-block-group.wp-container-6 > * + *{margin-block-start:var(--wp--preset--spacing--70);margin-block-end:0;}',
     264            ),
    251265        );
    252266    }
Note: See TracChangeset for help on using the changeset viewer.