<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56806] trunk/tests/phpunit/tests/block-supports: Editor: Add additional unit tests for elements block support.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56806">56806</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56806","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>flixos90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-10-09 16:38:26 +0000 (Mon, 09 Oct 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Add additional unit tests for elements block support.
Props aaronrobertshaw, costdev.
Fixes <a href="https://core.trac.wordpress.org/ticket/59555">#59555</a>.
See <a href="https://core.trac.wordpress.org/ticket/59544">#59544</a>.</pre>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsblocksupportswpRenderElementsSupportphp">trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportswpRenderElementsSupportStylesphp">trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsblocksupportselementsphp">trunk/tests/phpunit/tests/block-supports/elements.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsblocksupportselementsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/block-supports/elements.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/elements.php 2023-10-09 16:38:25 UTC (rev 56805)
+++ trunk/tests/phpunit/tests/block-supports/elements.php 2023-10-09 16:38:26 UTC (rev 56806)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,173 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * @group block-supports
- *
- * @covers ::wp_render_elements_support
- */
-class Tests_Block_Supports_Elements extends WP_UnitTestCase {
- /**
- * Given a string containing a class prefixed by "wp-elements-" followed by a unique id,
- * this function returns a string where the id is one instead of being unique.
- *
- * @param string $block_content String containing unique id classes.
- * @return string String where the unique id classes were replaced with "wp-elements-1".
- */
- private static function make_unique_id_one( $block_content ) {
- return preg_replace( '/wp-elements-[a-zA-Z0-9]+/', 'wp-elements-1', $block_content );
- }
-
- /**
- * Test wp_render_elements_support() with a simple paragraph and link color preset.
- * @ticket 54337
- */
- public function test_simple_paragraph_link_color() {
- $result = self::make_unique_id_one(
- wp_render_elements_support(
- '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
- array(
- 'blockName' => 'core/paragraph',
- 'attrs' => array(
- 'style' => array(
- 'elements' => array(
- 'link' => array(
- 'color' => array(
- 'text' => 'var:preset|color|subtle-background',
- ),
- ),
- ),
- ),
- ),
- )
- )
- );
- $this->assertSame(
- $result,
- '<p class="wp-elements-1">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>'
- );
- }
-
- /**
- * Test wp_render_elements_support() with a paragraph containing a class.
- * @ticket 54337
- */
- public function test_class_paragraph_link_color() {
- $result = self::make_unique_id_one(
- wp_render_elements_support(
- '<p class="has-dark-gray-background-color has-background">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
- array(
- 'blockName' => 'core/paragraph',
- 'attrs' => array(
- 'style' => array(
- 'elements' => array(
- 'link' => array(
- 'color' => array(
- 'text' => 'red',
- ),
- ),
- ),
- ),
- 'backgroundColor' => 'dark-gray',
- ),
- )
- )
- );
- $this->assertSame(
- $result,
- '<p class="has-dark-gray-background-color has-background wp-elements-1">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>'
- );
- }
-
- /**
- * Test wp_render_elements_support() with a paragraph containing a anchor.
- * @ticket 54337
- */
- public function test_anchor_paragraph_link_color() {
- $result = self::make_unique_id_one(
- wp_render_elements_support(
- '<p id="anchor">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
- array(
- 'blockName' => 'core/paragraph',
- 'attrs' => array(
- 'style' => array(
- 'elements' => array(
- 'link' => array(
- 'color' => array(
- 'text' => '#fff000',
- ),
- ),
- ),
- ),
- ),
- )
- )
- );
- $this->assertSame(
- $result,
- '<p class="wp-elements-1" id="anchor">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>'
- );
- }
-
- /**
- * Test wp_render_elements_support() with a group block that has a button
- * element color set.
- *
- * @ticket 59309
- */
- public function test_group_with_button_element_style() {
- $result = self::make_unique_id_one(
- wp_render_elements_support(
- '<div class="wp-block-group"><div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex"><div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Button</a></div></div></div>',
- array(
- 'blockName' => 'core/group',
- 'attrs' => array(
- 'style' => array(
- 'elements' => array(
- 'button' => array(
- 'color' => array(
- 'text' => 'var:preset|color|vivid-red',
- ),
- ),
- ),
- ),
- ),
- )
- )
- );
- $this->assertSame(
- $result,
- '<div class="wp-block-group wp-elements-1"><div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex"><div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Button</a></div></div></div>'
- );
- }
-
- /**
- * Test wp_render_elements_support() with a group block that has a heading
- * element color set.
- *
- * @ticket 59309
- */
- public function test_group_with_heading_element_style() {
- $result = self::make_unique_id_one(
- wp_render_elements_support(
- '<div class="wp-block-group"><h2 class="wp-block-heading">Test</h2></div>',
- array(
- 'blockName' => 'core/group',
- 'attrs' => array(
- 'style' => array(
- 'elements' => array(
- 'heading' => array(
- 'color' => array(
- 'text' => 'var:preset|color|vivid-red',
- ),
- ),
- ),
- ),
- ),
- )
- )
- );
- $this->assertSame(
- $result,
- '<div class="wp-block-group wp-elements-1"><h2 class="wp-block-heading">Test</h2></div>'
- );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsblocksupportswpRenderElementsSupportphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php (rev 0)
+++ trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php 2023-10-09 16:38:26 UTC (rev 56806)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,158 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * @group block-supports
+ *
+ * @covers ::wp_render_elements_support
+ */
+class Tests_Block_Supports_WpRenderElementsSupport extends WP_UnitTestCase {
+ /**
+ * @var string|null
+ */
+ private $test_block_name;
+
+ public function tear_down() {
+ WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
+ unregister_block_type( $this->test_block_name );
+ $this->test_block_name = null;
+ parent::tear_down();
+ }
+
+ /**
+ * Tests that elements block support applies the correct classname.
+ *
+ * @ticket 59555
+ *
+ * @covers ::wp_render_elements_support
+ *
+ * @dataProvider data_elements_block_support_class
+ *
+ * @param array $color_settings The color block support settings used for elements support.
+ * @param array $elements_styles The elements styles within the block attributes.
+ * @param string $block_markup Original block markup.
+ * @param string $expected_markup Resulting markup after application of elements block support.
+ */
+ public function test_elements_block_support_class( $color_settings, $elements_styles, $block_markup, $expected_markup ) {
+ $this->test_block_name = 'test/element-block-supports';
+
+ register_block_type(
+ $this->test_block_name,
+ array(
+ 'api_version' => 3,
+ 'attributes' => array(
+ 'style' => array(
+ 'type' => 'object',
+ ),
+ ),
+ 'supports' => array(
+ 'color' => $color_settings,
+ ),
+ )
+ );
+
+ $block = array(
+ 'blockName' => $this->test_block_name,
+ 'attrs' => array(
+ 'style' => array(
+ 'elements' => $elements_styles,
+ ),
+ ),
+ );
+
+ $actual = wp_render_elements_support( $block_markup, $block );
+
+ $this->assertMatchesRegularExpression(
+ $expected_markup,
+ $actual,
+ 'Position block wrapper markup should be correct'
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_elements_block_support_class() {
+ $color_styles = array(
+ 'text' => 'var:preset|color|vivid-red',
+ 'background' => '#fff',
+ );
+
+ return array(
+ 'button element styles with serialization skipped' => array(
+ 'color_settings' => array(
+ 'button' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'button' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p>Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'link element styles with serialization skipped' => array(
+ 'color_settings' => array(
+ 'link' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'link' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p>Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'heading element styles with serialization skipped' => array(
+ 'color_settings' => array(
+ 'heading' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'heading' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p>Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'button element styles apply class to wrapper' => array(
+ 'color_settings' => array( 'button' => true ),
+ 'elements_styles' => array(
+ 'button' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p class="wp-elements-[a-f0-9]{32}">Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'link element styles apply class to wrapper' => array(
+ 'color_settings' => array( 'link' => true ),
+ 'elements_styles' => array(
+ 'link' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p class="wp-elements-[a-f0-9]{32}">Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'heading element styles apply class to wrapper' => array(
+ 'color_settings' => array( 'heading' => true ),
+ 'elements_styles' => array(
+ 'heading' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p class="wp-elements-[a-f0-9]{32}">Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'element styles apply class to wrapper when it has other classes' => array(
+ 'color_settings' => array( 'link' => true ),
+ 'elements_styles' => array(
+ 'link' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p class="has-dark-gray-background-color has-background">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p class="has-dark-gray-background-color has-background wp-elements-[a-f0-9]{32}">Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ 'element styles apply class to wrapper when it has other attributes' => array(
+ 'color_settings' => array( 'link' => true ),
+ 'elements_styles' => array(
+ 'link' => array( 'color' => $color_styles ),
+ ),
+ 'block_markup' => '<p id="anchor">Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>',
+ 'expected_markup' => '/^<p class="wp-elements-[a-f0-9]{32}" id="anchor">Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/',
+ ),
+ );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestsblocksupportswpRenderElementsSupportStylesphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php (rev 0)
+++ trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php 2023-10-09 16:38:26 UTC (rev 56806)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,171 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * @group block-supports
+ *
+ * @covers ::wp_render_elements_support_styles
+ */
+class Tests_Block_Supports_WpRenderElementsSupportStyles extends WP_UnitTestCase {
+ /**
+ * @var string|null
+ */
+ private $test_block_name;
+
+ public function tear_down() {
+ WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
+ unregister_block_type( $this->test_block_name );
+ $this->test_block_name = null;
+ parent::tear_down();
+ }
+
+ /**
+ * Tests that elements block support generates appropriate styles.
+ *
+ * @ticket 59555
+ *
+ * @covers ::wp_render_elements_support_styles
+ *
+ * @dataProvider data_elements_block_support_styles
+ *
+ * @param mixed $color_settings The color block support settings used for elements support.
+ * @param mixed $elements_styles The elements styles within the block attributes.
+ * @param string $expected_styles Expected styles enqueued by the style engine.
+ */
+ public function test_elements_block_support_styles( $color_settings, $elements_styles, $expected_styles ) {
+ $this->test_block_name = 'test/element-block-supports';
+
+ register_block_type(
+ $this->test_block_name,
+ array(
+ 'api_version' => 3,
+ 'attributes' => array(
+ 'style' => array(
+ 'type' => 'object',
+ ),
+ ),
+ 'supports' => array(
+ 'color' => $color_settings,
+ ),
+ )
+ );
+
+ $block = array(
+ 'blockName' => $this->test_block_name,
+ 'attrs' => array(
+ 'style' => array(
+ 'elements' => $elements_styles,
+ ),
+ ),
+ );
+
+ wp_render_elements_support_styles( null, $block );
+ $actual_stylesheet = wp_style_engine_get_stylesheet_from_context( 'block-supports', array( 'prettify' => false ) );
+
+ $this->assertMatchesRegularExpression(
+ $expected_styles,
+ $actual_stylesheet,
+ 'Elements style rules output should be correct'
+ );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_elements_block_support_styles() {
+ $color_styles = array(
+ 'text' => 'var:preset|color|vivid-red',
+ 'background' => '#fff',
+ );
+ $color_css_rules = preg_quote( '{color:var(--wp--preset--color--vivid-red);background-color:#fff;}' );
+
+ return array(
+ 'button element styles are not applied if serialization is skipped' => array(
+ 'color_settings' => array(
+ 'button' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'button' => array( 'color' => $color_styles ),
+ ),
+ 'expected_styles' => '/^$/',
+ ),
+ 'link element styles are not applied if serialization is skipped' => array(
+ 'color_settings' => array(
+ 'link' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'link' => array(
+ 'color' => $color_styles,
+ ':hover' => array(
+ 'color' => $color_styles,
+ ),
+ ),
+ ),
+ 'expected_styles' => '/^$/',
+ ),
+ 'heading element styles are not applied if serialization is skipped' => array(
+ 'color_settings' => array(
+ 'heading' => true,
+ '__experimentalSkipSerialization' => true,
+ ),
+ 'elements_styles' => array(
+ 'heading' => array( 'color' => $color_styles ),
+ 'h1' => array( 'color' => $color_styles ),
+ 'h2' => array( 'color' => $color_styles ),
+ 'h3' => array( 'color' => $color_styles ),
+ 'h4' => array( 'color' => $color_styles ),
+ 'h5' => array( 'color' => $color_styles ),
+ 'h6' => array( 'color' => $color_styles ),
+ ),
+ 'expected_styles' => '/^$/',
+ ),
+ 'button element styles are applied' => array(
+ 'color_settings' => array( 'button' => true ),
+ 'elements_styles' => array(
+ 'button' => array( 'color' => $color_styles ),
+ ),
+ 'expected_styles' => '/^.wp-elements-[a-f0-9]{32} .wp-element-button, .wp-elements-[a-f0-9]{32} .wp-block-button__link' . $color_css_rules . '$/',
+ ),
+ 'link element styles are applied' => array(
+ 'color_settings' => array( 'link' => true ),
+ 'elements_styles' => array(
+ 'link' => array(
+ 'color' => $color_styles,
+ ':hover' => array(
+ 'color' => $color_styles,
+ ),
+ ),
+ ),
+ 'expected_styles' => '/^.wp-elements-[a-f0-9]{32} a' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} a:hover' . $color_css_rules . '$/',
+ ),
+ 'generic heading element styles are applied' => array(
+ 'color_settings' => array( 'heading' => true ),
+ 'elements_styles' => array(
+ 'heading' => array( 'color' => $color_styles ),
+ ),
+ 'expected_styles' => '/^.wp-elements-[a-f0-9]{32} h1, .wp-elements-[a-f0-9]{32} h2, .wp-elements-[a-f0-9]{32} h3, .wp-elements-[a-f0-9]{32} h4, .wp-elements-[a-f0-9]{32} h5, .wp-elements-[a-f0-9]{32} h6' . $color_css_rules . '$/',
+ ),
+ 'individual heading element styles are applied' => array(
+ 'color_settings' => array( 'heading' => true ),
+ 'elements_styles' => array(
+ 'h1' => array( 'color' => $color_styles ),
+ 'h2' => array( 'color' => $color_styles ),
+ 'h3' => array( 'color' => $color_styles ),
+ 'h4' => array( 'color' => $color_styles ),
+ 'h5' => array( 'color' => $color_styles ),
+ 'h6' => array( 'color' => $color_styles ),
+ ),
+ 'expected_styles' => '/^.wp-elements-[a-f0-9]{32} h1' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} h2' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} h3' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} h4' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} h5' . $color_css_rules .
+ '.wp-elements-[a-f0-9]{32} h6' . $color_css_rules . '$/',
+ ),
+ );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span></div>
</body>
</html>