From a5bdfd9793ae99fa08290cc57bdfb829e15351be Mon Sep 17 00:00:00 2001 From: ramonjd Date: Tue, 2 Aug 2022 13:29:31 +1000 Subject: [PATCH 1/4] Added an optimize flag to toggle combining selectors Adding tests Updating comments --- lib/block-supports/elements.php | 3 -- .../class-wp-style-engine-processor.php | 15 ++++++-- .../style-engine/class-wp-style-engine.php | 10 +++--- .../class-wp-style-engine-processor-test.php | 36 ++++++++++++++++++- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/lib/block-supports/elements.php b/lib/block-supports/elements.php index 2a512eab82ca96..abcf8d340d3fc4 100644 --- a/lib/block-supports/elements.php +++ b/lib/block-supports/elements.php @@ -92,9 +92,6 @@ function gutenberg_render_elements_support_styles( $pre_render, $block ) { /* * For now we only care about link color. - * This code in the future when we have a public API - * should take advantage of WP_Theme_JSON_Gutenberg::compute_style_properties - * and work for any element and style. */ $skip_link_color_serialization = gutenberg_should_skip_block_supports_serialization( $block_type, 'color', 'link' ); diff --git a/packages/style-engine/class-wp-style-engine-processor.php b/packages/style-engine/class-wp-style-engine-processor.php index 088513e83284d1..e33c40e50abb8c 100644 --- a/packages/style-engine/class-wp-style-engine-processor.php +++ b/packages/style-engine/class-wp-style-engine-processor.php @@ -63,16 +63,27 @@ public function add_rules( $css_rules ) { /** * Get the CSS rules as a string. * + * @param array $options array( + * 'optimize' => (boolean) Whether to optimize the CSS output, e.g., combine rules. + * );. + * * @return string The computed CSS. */ - public function get_css() { + public function get_css( $options = array() ) { + $defaults = array( + 'optimize' => true, + ); + $options = wp_parse_args( $options, $defaults ); + // If we have stores, get the rules from them. foreach ( $this->stores as $store ) { $this->add_rules( $store->get_all_rules() ); } // Combine CSS selectors that have identical declarations. - $this->combine_rules_selectors(); + if ( true === $options['optimize'] ) { + $this->combine_rules_selectors(); + } // Build the CSS. $css = ''; diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php index 33533fc872f699..f7f11c1e4b7450 100644 --- a/packages/style-engine/class-wp-style-engine.php +++ b/packages/style-engine/class-wp-style-engine.php @@ -666,10 +666,12 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { * * @access public * - * @param string $store_key A valid store key. - * @param array $css_rules array( - * 'selector' => (string) A CSS selector. - * 'declarations' => (boolean) An array of CSS definitions, e.g., array( "$property" => "$value" ). + * @param string $store_key A valid store key. + * @param array $css_rules array( + * array( + * 'selector' => (string) A CSS selector. + * declarations' => (boolean) An array of CSS definitions, e.g., array( "$property" => "$value" ). + * ) * );. * * @return WP_Style_Engine_CSS_Rules_Store|null. diff --git a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php index ebee00f05ce16a..d4444e51723164 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php @@ -56,7 +56,7 @@ public function test_return_store_rules_as_css() { 'background-color' => 'purple', ) ); - $a_nice_renderer = new WP_Style_Engine_Processor_Gutenberg(); + $a_nice_renderer = new WP_Style_Engine_Processor(); $a_nice_renderer->add_store( $a_nice_store ); $this->assertEquals( '.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}', $a_nice_renderer->get_css() ); } @@ -98,6 +98,40 @@ public function test_dedupe_and_merge_css_declarations() { $this->assertEquals( '.an-excellent-rule {color: var(--excellent-color); border-style: dashed; border-color: brown; border-width: 2px;}', $an_excellent_processor->get_css() ); } + /** + * Should print out uncombined selectors duplicate CSS rules. + */ + public function test_output_verbose_css_rules() { + $a_sweet_rule = new WP_Style_Engine_CSS_Rule( + '.a-sweet-rule', + array( + 'color' => 'var(--sweet-color)', + 'background-color' => 'purple', + ) + ); + + $a_sweeter_rule = new WP_Style_Engine_CSS_Rule( + '#an-even-sweeter-rule > marquee', + array( + 'color' => 'var(--sweet-color)', + 'background-color' => 'purple', + ) + ); + + $the_sweetest_rule = new WP_Style_Engine_CSS_Rule( + '.the-sweetest-rule-of-all a', + array( + 'color' => 'var(--sweet-color)', + 'background-color' => 'purple', + ) + ); + + $a_sweet_processor = new WP_Style_Engine_Processor(); + $a_sweet_processor->add_rules( array( $a_sweet_rule, $a_sweeter_rule, $the_sweetest_rule ) ); + + $this->assertEquals( '.a-sweet-rule {color: var(--sweet-color); background-color: purple;}#an-even-sweeter-rule > marquee {color: var(--sweet-color); background-color: purple;}.the-sweetest-rule-of-all a {color: var(--sweet-color); background-color: purple;}', $a_sweet_processor->get_css( array( 'optimize' => false ) ) ); + } + /** * Should combine duplicate CSS rules. */ From 35bddbb02c296b58a3598b4732ec25d9dd3bdf87 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Tue, 2 Aug 2022 13:51:06 +1000 Subject: [PATCH 2/4] Merged `wp_style_engine_get_stylesheet_from_css_rules()` and `wp_style_engine_add_to_store()` into `wp_style_engine_get_stylesheet()` --- lib/block-supports/layout.php | 10 ++- .../style-engine/class-wp-style-engine.php | 70 +++++++------------ .../class-wp-style-engine-processor-test.php | 2 +- .../phpunit/class-wp-style-engine-test.php | 39 +++++++++-- 4 files changed, 65 insertions(+), 56 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 8ae0ffc007fa98..e72b3505f1262b 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -204,11 +204,15 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support if ( ! empty( $layout_styles ) ) { // Add to the style engine store to enqueue and render layout styles. - gutenberg_style_engine_add_to_store( 'layout-block-supports', $layout_styles ); - // Return compiled layout styles to retain backwards compatibility. // Since https://github.com/WordPress/gutenberg/pull/42452 we no longer call wp_enqueue_block_support_styles in this block supports file. - return gutenberg_style_engine_get_stylesheet_from_css_rules( $layout_styles ); + return gutenberg_style_engine_get_stylesheet( + $layout_styles, + array( + 'context' => 'layout-block-supports', + 'enqueue' => true, + ) + ); } return ''; diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php index f7f11c1e4b7450..12a94efbff8957 100644 --- a/packages/style-engine/class-wp-style-engine.php +++ b/packages/style-engine/class-wp-style-engine.php @@ -623,15 +623,14 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { if ( ! class_exists( 'WP_Style_Engine' ) ) { return array(); } - $defaults = array( + $defaults = array( 'selector' => null, 'context' => 'block-supports', 'convert_vars_to_classnames' => false, 'enqueue' => false, ); - - $style_engine = WP_Style_Engine::get_instance(); $options = wp_parse_args( $options, $defaults ); + $style_engine = WP_Style_Engine::get_instance(); $parsed_styles = null; // Block supports styles. @@ -661,66 +660,47 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { return array_filter( $styles_output ); } -/** - * Global public interface method to register styles to be enqueued and rendered. - * - * @access public - * - * @param string $store_key A valid store key. - * @param array $css_rules array( - * array( - * 'selector' => (string) A CSS selector. - * declarations' => (boolean) An array of CSS definitions, e.g., array( "$property" => "$value" ). - * ) - * );. - * - * @return WP_Style_Engine_CSS_Rules_Store|null. - */ -function wp_style_engine_add_to_store( $store_key, $css_rules = array() ) { - if ( ! class_exists( 'WP_Style_Engine' ) || ! $store_key ) { - return null; - } - - // Get instance here to ensure that we register hooks to enqueue stored styles. - $style_engine = WP_Style_Engine::get_instance(); - - if ( empty( $css_rules ) ) { - return $style_engine::get_store( $store_key ); - } - - foreach ( $css_rules as $css_rule ) { - if ( empty( $css_rule['selector'] ) || empty( $css_rule['declarations'] ) ) { - continue; - } - $style_engine::store_css_rule( $store_key, $css_rule['selector'], $css_rule['declarations'] ); - } - return $style_engine::get_store( $store_key ); -} - /** * Returns compiled CSS from a collection of selectors and declarations. * This won't add to any store, but is useful for returning a compiled style sheet from any CSS selector + declarations combos. * * @access public * - * @param array $css_rules array( - * 'selector' => (string) A CSS selector. - * 'declarations' => (boolean) An array of CSS definitions, e.g., array( "$property" => "$value" ). + * @param array $css_rules array( + * array( + * 'selector' => (string) A CSS selector. + * declarations' => (boolean) An array of CSS definitions, e.g., array( "$property" => "$value" ). + * ) + * );. + * @param array $options array( + * 'context' => (string) An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is 'block-supports'. + * 'enqueue' => (boolean) When `true` will attempt to store and enqueue for rendering on the frontend. * );. * * @return string A compiled CSS string. */ -function wp_style_engine_get_stylesheet_from_css_rules( $css_rules = array() ) { - if ( ! class_exists( 'WP_Style_Engine' ) ) { +function wp_style_engine_get_stylesheet( $css_rules, $options ) { + if ( ! class_exists( 'WP_Style_Engine' ) || empty( $css_rules ) ) { return ''; } + $defaults = array( + 'context' => 'block-supports', + 'enqueue' => false, + ); + $options = wp_parse_args( $options, $defaults ); + $style_engine = WP_Style_Engine::get_instance(); $css_rule_objects = array(); foreach ( $css_rules as $css_rule ) { if ( empty( $css_rule['selector'] ) || empty( $css_rule['declarations'] ) || ! is_array( $css_rule['declarations'] ) ) { continue; } + + if ( true === $options['enqueue'] ) { + $style_engine::store_css_rule( $options['context'], $css_rule['selector'], $css_rule['declarations'] ); + } + $css_rule_objects[] = new WP_Style_Engine_CSS_Rule( $css_rule['selector'], $css_rule['declarations'] ); } @@ -728,5 +708,5 @@ function wp_style_engine_get_stylesheet_from_css_rules( $css_rules = array() ) { return ''; } - return WP_Style_Engine::compile_stylesheet_from_css_rules( $css_rule_objects ); + return $style_engine::compile_stylesheet_from_css_rules( $css_rule_objects ); } diff --git a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php index d4444e51723164..b6ac6c801790f5 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php @@ -42,7 +42,7 @@ public function test_return_rules_as_css() { * Should compile CSS rules from the store. */ public function test_return_store_rules_as_css() { - $a_nice_store = WP_Style_Engine_CSS_Rules_Store_Gutenberg::get_store( 'nice' ); + $a_nice_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'nice' ); $a_nice_store->add_rule( '.a-nice-rule' )->add_declarations( array( 'color' => 'var(--nice-color)', diff --git a/packages/style-engine/phpunit/class-wp-style-engine-test.php b/packages/style-engine/phpunit/class-wp-style-engine-test.php index 14938e075fa260..9c34a1bc22534f 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-test.php @@ -540,14 +540,39 @@ public function test_enqueue_block_styles_store() { * Tests adding rules to a store and retrieving a generated stylesheet. */ public function test_add_to_store() { - $store = wp_style_engine_add_to_store( 'test-store', array() ); - - // wp_style_engine_add_to_store returns a store object. - $this->assertInstanceOf( 'WP_Style_Engine_CSS_Rules_Store', $store ); + $css_rules = array( + array( + 'selector' => '.frodo', + 'declarations' => array( + 'color' => 'brown', + 'height' => '10px', + 'width' => '30px', + 'border-style' => 'dotted', + ), + ), + array( + 'selector' => '.samwise', + 'declarations' => array( + 'color' => 'brown', + 'height' => '20px', + 'width' => '50px', + 'border-style' => 'solid', + ), + ), + ); + $compiled_stylesheet = wp_style_engine_get_stylesheet( + $css_rules, + array( + 'context' => 'test-store', + 'enqueue' => true, + ) + ); // Check that the style engine knows about the store. - $stored_store = WP_Style_Engine::get_instance()::get_store( 'test-store' ); + $style_engine = WP_Style_Engine::get_instance(); + $stored_store = $style_engine::get_store( 'test-store' ); $this->assertInstanceOf( 'WP_Style_Engine_CSS_Rules_Store', $stored_store ); + $this->assertSame( $compiled_stylesheet, $style_engine::compile_stylesheet_from_css_rules( $stored_store->get_all_rules() ) ); } /** @@ -584,7 +609,7 @@ public function test_get_stylesheet_from_css_rules() { ), ); - $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); + $compiled_stylesheet = wp_style_engine_get_stylesheet( $css_rules ); $this->assertSame( '.saruman {color: white; height: 100px; border-style: solid; align-self: unset;}.gandalf {color: grey; height: 90px; border-style: dotted; align-self: safe center;}.radagast {color: brown; height: 60px; border-style: dashed; align-self: stretch;}', $compiled_stylesheet ); } @@ -628,7 +653,7 @@ public function test_get_deduped_and_merged_stylesheet() { ), ); - $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); + $compiled_stylesheet = wp_style_engine_get_stylesheet( $css_rules ); $this->assertSame( '.gandalf {color: white; height: 190px; border-style: dotted; padding: 10px; margin-bottom: 100px;}.dumbledore,.rincewind {color: grey; height: 90px; border-style: dotted;}', $compiled_stylesheet ); } } From 62db82f4f9a62ce156a157364fddd8b06a8a131a Mon Sep 17 00:00:00 2001 From: ramonjd Date: Tue, 2 Aug 2022 14:06:36 +1000 Subject: [PATCH 3/4] Default $options value to avoid "Too few arguments" warning in PHP unit tests --- packages/style-engine/class-wp-style-engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php index 12a94efbff8957..f7f1aefdd7d220 100644 --- a/packages/style-engine/class-wp-style-engine.php +++ b/packages/style-engine/class-wp-style-engine.php @@ -679,7 +679,7 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { * * @return string A compiled CSS string. */ -function wp_style_engine_get_stylesheet( $css_rules, $options ) { +function wp_style_engine_get_stylesheet( $css_rules, $options = array() ) { if ( ! class_exists( 'WP_Style_Engine' ) || empty( $css_rules ) ) { return ''; } From 5b288e9b66e3885d14f11d85abf7a84dca240358 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Wed, 3 Aug 2022 13:14:45 +1000 Subject: [PATCH 4/4] Rename wp_style_engine_get_stylesheet to wp_style_engine_get_stylesheet_from_css_rules Formatting tests for readability --- lib/block-supports/layout.php | 2 +- .../style-engine/class-wp-style-engine.php | 2 +- .../class-wp-style-engine-processor-test.php | 35 +++++++++++++++---- .../phpunit/class-wp-style-engine-test.php | 6 ++-- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index e72b3505f1262b..21b7b9691b4ac9 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -206,7 +206,7 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support // Add to the style engine store to enqueue and render layout styles. // Return compiled layout styles to retain backwards compatibility. // Since https://github.com/WordPress/gutenberg/pull/42452 we no longer call wp_enqueue_block_support_styles in this block supports file. - return gutenberg_style_engine_get_stylesheet( + return gutenberg_style_engine_get_stylesheet_from_css_rules( $layout_styles, array( 'context' => 'layout-block-supports', diff --git a/packages/style-engine/class-wp-style-engine.php b/packages/style-engine/class-wp-style-engine.php index f7f1aefdd7d220..944a3cc7872a08 100644 --- a/packages/style-engine/class-wp-style-engine.php +++ b/packages/style-engine/class-wp-style-engine.php @@ -679,7 +679,7 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { * * @return string A compiled CSS string. */ -function wp_style_engine_get_stylesheet( $css_rules, $options = array() ) { +function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = array() ) { if ( ! class_exists( 'WP_Style_Engine' ) || empty( $css_rules ) ) { return ''; } diff --git a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php index b6ac6c801790f5..af306390136072 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-processor-test.php @@ -35,7 +35,10 @@ public function test_return_rules_as_css() { ); $a_nice_processor = new WP_Style_Engine_Processor(); $a_nice_processor->add_rules( array( $a_nice_css_rule, $a_nicer_css_rule ) ); - $this->assertEquals( '.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}', $a_nice_processor->get_css() ); + $this->assertEquals( + '.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}', + $a_nice_processor->get_css() + ); } /** @@ -58,7 +61,10 @@ public function test_return_store_rules_as_css() { ); $a_nice_renderer = new WP_Style_Engine_Processor(); $a_nice_renderer->add_store( $a_nice_store ); - $this->assertEquals( '.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}', $a_nice_renderer->get_css() ); + $this->assertEquals( + '.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}', + $a_nice_renderer->get_css() + ); } /** @@ -84,7 +90,10 @@ public function test_dedupe_and_merge_css_declarations() { ) ); $an_excellent_processor->add_rules( $another_excellent_rule ); - $this->assertEquals( '.an-excellent-rule {color: var(--excellent-color); border-style: dotted; border-color: brown;}', $an_excellent_processor->get_css() ); + $this->assertEquals( + '.an-excellent-rule {color: var(--excellent-color); border-style: dotted; border-color: brown;}', + $an_excellent_processor->get_css() + ); $yet_another_excellent_rule = new WP_Style_Engine_CSS_Rule( '.an-excellent-rule' ); $yet_another_excellent_rule->add_declarations( @@ -95,7 +104,10 @@ public function test_dedupe_and_merge_css_declarations() { ) ); $an_excellent_processor->add_rules( $yet_another_excellent_rule ); - $this->assertEquals( '.an-excellent-rule {color: var(--excellent-color); border-style: dashed; border-color: brown; border-width: 2px;}', $an_excellent_processor->get_css() ); + $this->assertEquals( + '.an-excellent-rule {color: var(--excellent-color); border-style: dashed; border-color: brown; border-width: 2px;}', + $an_excellent_processor->get_css() + ); } /** @@ -129,7 +141,10 @@ public function test_output_verbose_css_rules() { $a_sweet_processor = new WP_Style_Engine_Processor(); $a_sweet_processor->add_rules( array( $a_sweet_rule, $a_sweeter_rule, $the_sweetest_rule ) ); - $this->assertEquals( '.a-sweet-rule {color: var(--sweet-color); background-color: purple;}#an-even-sweeter-rule > marquee {color: var(--sweet-color); background-color: purple;}.the-sweetest-rule-of-all a {color: var(--sweet-color); background-color: purple;}', $a_sweet_processor->get_css( array( 'optimize' => false ) ) ); + $this->assertEquals( + '.a-sweet-rule {color: var(--sweet-color); background-color: purple;}#an-even-sweeter-rule > marquee {color: var(--sweet-color); background-color: purple;}.the-sweetest-rule-of-all a {color: var(--sweet-color); background-color: purple;}', + $a_sweet_processor->get_css( array( 'optimize' => false ) ) + ); } /** @@ -155,7 +170,10 @@ public function test_combine_css_rules() { $a_sweet_processor = new WP_Style_Engine_Processor(); $a_sweet_processor->add_rules( array( $a_sweet_rule, $a_sweeter_rule ) ); - $this->assertEquals( '.a-sweet-rule,#an-even-sweeter-rule > marquee {color: var(--sweet-color); background-color: purple;}', $a_sweet_processor->get_css() ); + $this->assertEquals( + '.a-sweet-rule,#an-even-sweeter-rule > marquee {color: var(--sweet-color); background-color: purple;}', + $a_sweet_processor->get_css() + ); } /** * Should combine and store CSS rules. @@ -194,6 +212,9 @@ public function test_combine_previously_added_css_rules() { ); $a_lovely_processor->add_rules( $a_perfectly_lovely_rule ); - $this->assertEquals( '.a-lovely-rule,.a-lovelier-rule,.a-most-lovely-rule,.a-perfectly-lovely-rule {border-color: purple;}', $a_lovely_processor->get_css() ); + $this->assertEquals( + '.a-lovely-rule,.a-lovelier-rule,.a-most-lovely-rule,.a-perfectly-lovely-rule {border-color: purple;}', + $a_lovely_processor->get_css() + ); } } diff --git a/packages/style-engine/phpunit/class-wp-style-engine-test.php b/packages/style-engine/phpunit/class-wp-style-engine-test.php index 9c34a1bc22534f..9c3ca271faa3d8 100644 --- a/packages/style-engine/phpunit/class-wp-style-engine-test.php +++ b/packages/style-engine/phpunit/class-wp-style-engine-test.php @@ -560,7 +560,7 @@ public function test_add_to_store() { ), ), ); - $compiled_stylesheet = wp_style_engine_get_stylesheet( + $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules, array( 'context' => 'test-store', @@ -609,7 +609,7 @@ public function test_get_stylesheet_from_css_rules() { ), ); - $compiled_stylesheet = wp_style_engine_get_stylesheet( $css_rules ); + $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); $this->assertSame( '.saruman {color: white; height: 100px; border-style: solid; align-self: unset;}.gandalf {color: grey; height: 90px; border-style: dotted; align-self: safe center;}.radagast {color: brown; height: 60px; border-style: dashed; align-self: stretch;}', $compiled_stylesheet ); } @@ -653,7 +653,7 @@ public function test_get_deduped_and_merged_stylesheet() { ), ); - $compiled_stylesheet = wp_style_engine_get_stylesheet( $css_rules ); + $compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); $this->assertSame( '.gandalf {color: white; height: 190px; border-style: dotted; padding: 10px; margin-bottom: 100px;}.dumbledore,.rincewind {color: grey; height: 90px; border-style: dotted;}', $compiled_stylesheet ); } }