Make WordPress Core


Ignore:
Timestamp:
07/31/2024 02:39:46 AM (19 months ago)
Author:
ramonopoly
Message:

Background: add background attachment support to theme.json styles

Introduces the ability to specify a value for background.backgroundAttachment in theme.json styles.

The theme.json value determines the CSS value for the background-attachment property.

This feature was introduced into the Gutenberg plugin in version 18.9.

Props andrewserong, mukesh27, noisysocks, ramonopoly.

Fixes #61720

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/style-engine/styleEngine.php

    r58089 r58834  
    2929     * @ticket 58590
    3030     * @ticket 60175
     31     * @ticket 61720
    3132     *
    3233     * @covers ::wp_style_engine_get_styles
     
    540541                'block_styles'    => array(
    541542                    'background' => array(
    542                         'backgroundImage'    => array(
     543                        'backgroundImage'      => array(
    543544                            'url' => 'https://example.com/image.jpg',
    544545                        ),
    545                         'backgroundPosition' => 'center',
    546                         'backgroundRepeat'   => 'no-repeat',
    547                         'backgroundSize'     => 'cover',
     546                        'backgroundPosition'   => 'center',
     547                        'backgroundRepeat'     => 'no-repeat',
     548                        'backgroundSize'       => 'cover',
     549                        'backgroundAttachment' => 'fixed',
    548550                    ),
    549551                ),
    550552                'options'         => array(),
    551553                'expected_output' => array(
    552                     'css'          => "background-image:url('https://example.com/image.jpg');background-position:center;background-repeat:no-repeat;background-size:cover;",
    553                     'declarations' => array(
    554                         'background-image'    => "url('https://example.com/image.jpg')",
    555                         'background-position' => 'center',
    556                         'background-repeat'   => 'no-repeat',
    557                         'background-size'     => 'cover',
     554                    'css'          => "background-image:url('https://example.com/image.jpg');background-position:center;background-repeat:no-repeat;background-size:cover;background-attachment:fixed;",
     555                    'declarations' => array(
     556                        'background-image'      => "url('https://example.com/image.jpg')",
     557                        'background-position'   => 'center',
     558                        'background-repeat'     => 'no-repeat',
     559                        'background-size'       => 'cover',
     560                        'background-attachment' => 'fixed',
    558561                    ),
    559562                ),
Note: See TracChangeset for help on using the changeset viewer.