- Timestamp:
- 02/12/2026 05:43:12 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-supports/wpApplyDimensionsSupport.php
r61619 r61620 172 172 ); 173 173 } 174 175 /** 176 * Tests that height block support works as expected. 177 * 178 * @ticket 64202 179 * 180 * @covers ::wp_apply_dimensions_support 181 * 182 * @dataProvider data_height_block_support 183 * 184 * @param string $block_name The test block name to register. 185 * @param mixed $dimensions The dimensions block support settings. 186 * @param mixed $expected The expected results. 187 */ 188 public function test_height_block_support( $block_name, $dimensions, $expected ) { 189 $this->test_block_name = $block_name; 190 register_block_type( 191 $this->test_block_name, 192 array( 193 'api_version' => 2, 194 'attributes' => array( 195 'style' => array( 196 'type' => 'object', 197 ), 198 ), 199 'supports' => array( 200 'dimensions' => $dimensions, 201 ), 202 ) 203 ); 204 $registry = WP_Block_Type_Registry::get_instance(); 205 $block_type = $registry->get_registered( $this->test_block_name ); 206 $block_attrs = array( 207 'style' => array( 208 'dimensions' => array( 209 'height' => '400px', 210 ), 211 ), 212 ); 213 214 $actual = wp_apply_dimensions_support( $block_type, $block_attrs ); 215 216 $this->assertSame( $expected, $actual ); 217 } 218 219 /** 220 * Data provider. 221 * 222 * @return array 223 */ 224 public function data_height_block_support() { 225 return array( 226 'style is applied' => array( 227 'block_name' => 'test/height-style-is-applied', 228 'dimensions' => array( 229 'height' => true, 230 ), 231 'expected' => array( 232 'style' => 'height:400px;', 233 ), 234 ), 235 'style output is skipped when individual feature serialization is skipped' => array( 236 'block_name' => 'test/height-with-individual-skipped-serialization-block-supports', 237 'dimensions' => array( 238 'height' => true, 239 '__experimentalSkipSerialization' => array( 'height' ), 240 ), 241 'expected' => array(), 242 ), 243 ); 244 } 174 245 }
Note: See TracChangeset
for help on using the changeset viewer.