Changeset 56828
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/elements.php
r56807 r56828 37 37 38 38 $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); 39 if ( ! $block_type ) { 40 return $block_content; 41 } 39 42 40 43 $element_color_properties = array( -
trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupport.php
r56806 r56828 17 17 $this->test_block_name = null; 18 18 parent::tear_down(); 19 } 20 21 /** 22 * Tests that block supports leaves block content alone if the block type 23 * isn't registered. 24 * 25 * @ticket 59578 26 * 27 * @covers ::wp_render_elements_support 28 * 29 * @return void 30 */ 31 public function test_leaves_block_content_alone_when_block_type_not_registered() { 32 $block = array( 33 'blockName' => 'test/element-block-supports', 34 'attrs' => array( 35 'style' => array( 36 'elements' => array( 37 'button' => array( 38 'color' => array( 39 'text' => 'var:preset|color|vivid-red', 40 'background' => '#fff', 41 ), 42 ), 43 ), 44 ), 45 ), 46 ); 47 48 $block_markup = '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>'; 49 $actual = wp_render_elements_support( $block_markup, $block ); 50 51 $this->assertSame( $block_markup, $actual, 'Expected to leave block content unmodified, but found changes.' ); 19 52 } 20 53 … … 65 98 $expected_markup, 66 99 $actual, 67 ' Position block wrapper markup should be correct'100 'Block wrapper markup should be correct' 68 101 ); 69 102 } … … 81 114 82 115 return array( 116 // @ticket 59578 117 'empty block markup remains untouched' => array( 118 'color_settings' => array( 119 'button' => true, 120 ), 121 'elements_styles' => array( 122 'button' => array( 'color' => $color_styles ), 123 ), 124 'block_markup' => '', 125 'expected_markup' => '/^$/', 126 ), 127 'empty block markup remains untouched when no block attributes' => array( 128 'color_settings' => array( 129 'button' => true, 130 ), 131 'elements_styles' => null, 132 'block_markup' => '', 133 'expected_markup' => '/^$/', 134 ), 135 'block markup remains untouched when block has no attributes' => array( 136 'color_settings' => array( 137 'button' => true, 138 ), 139 'elements_styles' => null, 140 'block_markup' => '<p>Hello <a href="http://www.wordpress.org/">WordPress</a>!</p>', 141 'expected_markup' => '/^<p>Hello <a href="http:\/\/www.wordpress.org\/">WordPress<\/a>!<\/p>$/', 142 ), 143 // @ticket 5418 83 144 'button element styles with serialization skipped' => array( 84 145 'color_settings' => array(
Note: See TracChangeset
for help on using the changeset viewer.