Make WordPress Core


Ignore:
Timestamp:
06/29/2023 06:19:41 AM (21 months ago)
Author:
isabel_brison
Message:

Editor: update duotone support.

Updates duotone support after stabilisation of selectors API and adds a few small code quality and UI improvements.

Props onemaggie, peterwilsoncc, ajlende, audrasjb, mikeschroder, ramonopoly.
Fixes #58555.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpGetGlobalStylesSvgFilters.php

    r56042 r56101  
    1 <?php
    2 /**
    3  * Tests wp_get_global_styles_svg_filters().
    4  *
    5  * @group themes
    6  */
    7 class Tests_Theme_wpGetGlobalStylesSvgFilters extends WP_UnitTestCase {
    8     public function set_up() {
    9         parent::set_up();
    10         // Clear caches.
    11         wp_clean_themes_cache();
    12     }
    13 
    14     public function tear_down() {
    15         wp_clean_themes_cache();
    16 
    17         parent::tear_down();
    18     }
    19 
    20     /**
    21      * Tests that switching themes recalculates the svgs.
    22      *
    23      * @covers ::wp_get_global_styles_svg_filters
    24      *
    25      * @ticket 57568
    26      */
    27     public function test_switching_themes_should_recalculate_svg() {
    28         $svg_for_default_theme = wp_get_global_styles_svg_filters();
    29         switch_theme( 'block-theme' );
    30         $svg_for_block_theme = wp_get_global_styles_svg_filters();
    31         switch_theme( WP_DEFAULT_THEME );
    32 
    33         $this->assertStringContainsString( '<svg', $svg_for_default_theme, 'Default theme should contain SVG' );
    34         $this->assertStringContainsString( '<svg', $svg_for_default_theme, 'Block theme should contain SVG' );
    35         $this->assertNotSame( $svg_for_default_theme, $svg_for_block_theme, 'Cache value should have changed' );
    36     }
    37 
    38     /**
    39      * Tests that the function relies on the development mode for whether to use caching.
    40      *
    41      * @ticket 57487
    42      *
    43      * @covers ::wp_get_global_styles_svg_filters
    44      */
    45     public function test_caching_is_used_when_developing_theme() {
    46         global $_wp_tests_development_mode;
    47 
    48         switch_theme( 'block-theme' );
    49 
    50         // Store SVG in cache.
    51         $svg = '<svg></svg>';
    52         wp_cache_set( 'wp_get_global_styles_svg_filters', $svg, 'theme_json' );
    53 
    54         // By default, caching should be used, so the above value will be returned.
    55         $_wp_tests_development_mode = '';
    56         $this->assertSame( $svg, wp_get_global_styles_svg_filters(), 'Caching was not used despite development mode disabled' );
    57 
    58         // When the development mode is set to 'theme', caching should not be used.
    59         $_wp_tests_development_mode = 'theme';
    60         $this->assertNotSame( $svg, wp_get_global_styles_svg_filters(), 'Caching was used despite theme development mode' );
    61     }
    62 }
Note: See TracChangeset for help on using the changeset viewer.