Changeset 52434 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 01/04/2022 05:37:25 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r52402 r52434 420 420 'blockGap' => '1em', 421 421 ), 422 'blocks' => array( 423 'core/columns' => array( 424 'spacing' => array( 425 'blockGap' => '24px', 426 ), 427 ), 428 ), 429 ), 430 ) 431 ); 432 433 $expected = 'body { margin: 0; }body{--wp--style--block-gap: 1em;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }.wp-block-columns{--wp--style--block-gap: 24px;}'; 422 ), 423 ) 424 ); 425 426 $expected = 'body { margin: 0; }body{--wp--style--block-gap: 1em;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }'; 434 427 $this->assertSame( $expected, $theme_json->get_stylesheet() ); 435 428 $this->assertSame( $expected, $theme_json->get_stylesheet( array( 'styles' ) ) ); … … 2349 2342 } 2350 2343 2344 /** 2345 * @ticket 54487 2346 */ 2347 public function test_sanitization() { 2348 $theme_json = new WP_Theme_JSON( 2349 array( 2350 'version' => 2, 2351 'styles' => array( 2352 'spacing' => array( 2353 'blockGap' => 'valid value', 2354 ), 2355 'blocks' => array( 2356 'core/group' => array( 2357 'spacing' => array( 2358 'margin' => 'valid value', 2359 'blockGap' => 'invalid value', 2360 ), 2361 ), 2362 ), 2363 ), 2364 ) 2365 ); 2366 2367 $actual = $theme_json->get_raw_data(); 2368 $expected = array( 2369 'version' => 2, 2370 'styles' => array( 2371 'spacing' => array( 2372 'blockGap' => 'valid value', 2373 ), 2374 'blocks' => array( 2375 'core/group' => array( 2376 'spacing' => array( 2377 'margin' => 'valid value', 2378 ), 2379 ), 2380 ), 2381 ), 2382 ); 2383 2384 $this->assertEqualSetsWithIndex( $expected, $actual ); 2385 } 2386 2351 2387 }
Note: See TracChangeset
for help on using the changeset viewer.