Make WordPress Core


Ignore:
Timestamp:
05/03/2024 04:45:20 AM (7 months ago)
Author:
isabel_brison
Message:

Editor: add Style Engine support for nested CSS rules.

Adds support for passing a $rules_group string to wp_style_engine_get_stylesheet_from_css_rules(), so rules can be nested under a media query, layer or other rule.

Props isabel_brison, ramonopoly.
Fixes #61099.

File:
1 edited

Legend:

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

    r54394 r58089  
    3636
    3737        $this->assertSame( $expected, $css_rule->get_css(), 'Value returned by get_css() does not match expected declarations string.' );
     38    }
     39
     40    /**
     41     * Tests setting and getting a rules group.
     42     *
     43     * @ticket 61099
     44     *
     45     * @covers ::set_rules_group
     46     * @covers ::get_rules_group
     47     */
     48    public function test_should_set_rules_group() {
     49        $rule = new WP_Style_Engine_CSS_Rule( '.heres-johnny', array(), '@layer state' );
     50
     51        $this->assertSame( '@layer state', $rule->get_rules_group(), 'Return value of get_rules_group() does not match value passed to constructor.' );
     52
     53        $rule->set_rules_group( '@layer pony' );
     54
     55        $this->assertSame( '@layer pony', $rule->get_rules_group(), 'Return value of get_rules_group() does not match value passed to set_rules_group().' );
    3856    }
    3957
Note: See TracChangeset for help on using the changeset viewer.