Changeset 58478 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 06/24/2024 03:12:53 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r58466 r58478 5242 5242 $styles = $result->get_raw_data()['styles']; 5243 5243 5244 $this->assert Equals( 'var(--wp--preset--color--primary)', $styles['color']['background'], 'Top level: Assert the originally correct values are still correct.' );5245 $this->assert Equals( 'var(--wp--preset--color--secondary)', $styles['color']['text'], 'Top level: Assert the originally correct values are still correct.' );5246 5247 $this->assert Equals( 'var(--wp--preset--color--pri)', $styles['elements']['link']['color']['background'], 'Element top level: Assert the originally correct values are still correct.' );5248 $this->assert Equals( 'var(--wp--preset--color--sec)', $styles['elements']['link']['color']['text'], 'Element top level: Assert the originally correct values are still correct.' );5249 5250 $this->assert Equals( 'var(--wp--preset--font-size--small)', $styles['blocks']['core/post-terms']['typography']['fontSize'], 'Top block level: Assert the originally correct values are still correct.' );5251 $this->assert Equals( 'var(--wp--preset--color--secondary)', $styles['blocks']['core/post-terms']['color']['background'], 'Top block level: Assert the internal variables are convert to CSS custom variables.' );5252 5253 $this->assert Equals( 'var(--wp--preset--color--p)', $styles['blocks']['core/navigation']['elements']['link']['color']['background'], 'Elements block level: Assert the originally correct values are still correct.' );5254 $this->assert Equals( 'var(--wp--preset--color--s)', $styles['blocks']['core/navigation']['elements']['link']['color']['text'], 'Elements block level: Assert the originally correct values are still correct.' );5255 5256 $this->assert Equals( 'var(--wp--preset--font-size--s)', $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Style variations: Assert the originally correct values are still correct.' );5257 $this->assert Equals( 'var(--wp--preset--color--s)', $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Style variations: Assert the internal variables are convert to CSS custom variables.' );5244 $this->assertSame( 'var(--wp--preset--color--primary)', $styles['color']['background'], 'Top level: Assert the originally correct values are still correct.' ); 5245 $this->assertSame( 'var(--wp--preset--color--secondary)', $styles['color']['text'], 'Top level: Assert the originally correct values are still correct.' ); 5246 5247 $this->assertSame( 'var(--wp--preset--color--pri)', $styles['elements']['link']['color']['background'], 'Element top level: Assert the originally correct values are still correct.' ); 5248 $this->assertSame( 'var(--wp--preset--color--sec)', $styles['elements']['link']['color']['text'], 'Element top level: Assert the originally correct values are still correct.' ); 5249 5250 $this->assertSame( 'var(--wp--preset--font-size--small)', $styles['blocks']['core/post-terms']['typography']['fontSize'], 'Top block level: Assert the originally correct values are still correct.' ); 5251 $this->assertSame( 'var(--wp--preset--color--secondary)', $styles['blocks']['core/post-terms']['color']['background'], 'Top block level: Assert the internal variables are convert to CSS custom variables.' ); 5252 5253 $this->assertSame( 'var(--wp--preset--color--p)', $styles['blocks']['core/navigation']['elements']['link']['color']['background'], 'Elements block level: Assert the originally correct values are still correct.' ); 5254 $this->assertSame( 'var(--wp--preset--color--s)', $styles['blocks']['core/navigation']['elements']['link']['color']['text'], 'Elements block level: Assert the originally correct values are still correct.' ); 5255 5256 $this->assertSame( 'var(--wp--preset--font-size--s)', $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Style variations: Assert the originally correct values are still correct.' ); 5257 $this->assertSame( 'var(--wp--preset--color--s)', $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Style variations: Assert the internal variables are convert to CSS custom variables.' ); 5258 5258 } 5259 5259 … … 5402 5402 $styles = $theme_json::resolve_variables( $theme_json )->get_raw_data()['styles']; 5403 5403 5404 $this->assert Equals( $primary_color, $styles['color']['background'], 'Top level: Assert values are converted' );5405 $this->assert Equals( $raw_color_value, $styles['color']['text'], 'Top level: Assert raw values stay intact' );5406 5407 $this->assert Equals( $contrast_color, $styles['elements']['button']['color']['text'], 'Elements: color' );5408 $this->assert Equals( $small_font, $styles['elements']['button']['typography']['fontSize'], 'Elements: font-size' );5409 5410 $this->assert Equals( $large_font, $styles['blocks']['core/quote']['typography']['fontSize'], 'Blocks: font-size' );5411 $this->assert Equals( $primary_color, $styles['blocks']['core/quote']['color']['background'], 'Blocks: color' );5412 $this->assert Equals( $raw_color_value, $styles['blocks']['core/post-terms']['color']['background'], 'Blocks: Raw color value stays intact' );5413 $this->assert Equals( $small_font, $styles['blocks']['core/post-terms']['typography']['fontSize'], 'Block core/post-terms: font-size' );5414 $this->assert Equals(5404 $this->assertSame( $primary_color, $styles['color']['background'], 'Top level: Assert values are converted' ); 5405 $this->assertSame( $raw_color_value, $styles['color']['text'], 'Top level: Assert raw values stay intact' ); 5406 5407 $this->assertSame( $contrast_color, $styles['elements']['button']['color']['text'], 'Elements: color' ); 5408 $this->assertSame( $small_font, $styles['elements']['button']['typography']['fontSize'], 'Elements: font-size' ); 5409 5410 $this->assertSame( $large_font, $styles['blocks']['core/quote']['typography']['fontSize'], 'Blocks: font-size' ); 5411 $this->assertSame( $primary_color, $styles['blocks']['core/quote']['color']['background'], 'Blocks: color' ); 5412 $this->assertSame( $raw_color_value, $styles['blocks']['core/post-terms']['color']['background'], 'Blocks: Raw color value stays intact' ); 5413 $this->assertSame( $small_font, $styles['blocks']['core/post-terms']['typography']['fontSize'], 'Block core/post-terms: font-size' ); 5414 $this->assertSame( 5415 5415 "linear-gradient(90deg, $primary_color 0%, $secondary_color 35%, var(--wp--undefined--color--secondary) 100%)", 5416 5416 $styles['blocks']['core/more']['color']['background'], 5417 5417 'Blocks: multiple colors and undefined color' 5418 5418 ); 5419 $this->assert Equals( 'var(--undefined--font-size--small)', $styles['blocks']['core/more']['typography']['fontSize'], 'Blocks: undefined font-size ' );5420 $this->assert Equals( "calc($small_font + 20px)", $styles['blocks']['core/comment-content']['typography']['fontSize'], 'Blocks: font-size in random place' );5421 $this->assert Equals( $primary_color, $styles['blocks']['core/comment-content']['color']['text'], 'Blocks: text color with fallback' );5422 $this->assert Equals( $primary_color, $styles['blocks']['core/comment-content']['color']['background'], 'Blocks: background color with var as fallback' );5423 $this->assert Equals( $primary_color, $styles['blocks']['core/navigation']['elements']['link']['color']['background'], 'Block element: background color' );5424 $this->assert Equals( $secondary_color, $styles['blocks']['core/navigation']['elements']['link']['color']['text'], 'Block element: text color' );5425 $this->assert Equals( $large_font, $styles['blocks']['core/navigation']['elements']['link']['typography']['fontSize'], 'Block element: font-size' );5426 5427 $this->assert Equals(5419 $this->assertSame( 'var(--undefined--font-size--small)', $styles['blocks']['core/more']['typography']['fontSize'], 'Blocks: undefined font-size ' ); 5420 $this->assertSame( "calc($small_font + 20px)", $styles['blocks']['core/comment-content']['typography']['fontSize'], 'Blocks: font-size in random place' ); 5421 $this->assertSame( $primary_color, $styles['blocks']['core/comment-content']['color']['text'], 'Blocks: text color with fallback' ); 5422 $this->assertSame( $primary_color, $styles['blocks']['core/comment-content']['color']['background'], 'Blocks: background color with var as fallback' ); 5423 $this->assertSame( $primary_color, $styles['blocks']['core/navigation']['elements']['link']['color']['background'], 'Block element: background color' ); 5424 $this->assertSame( $secondary_color, $styles['blocks']['core/navigation']['elements']['link']['color']['text'], 'Block element: text color' ); 5425 $this->assertSame( $large_font, $styles['blocks']['core/navigation']['elements']['link']['typography']['fontSize'], 'Block element: font-size' ); 5426 5427 $this->assertSame( 5428 5428 "var(--undefined--color--primary, $small_font)", 5429 5429 $styles['blocks']['core/comments']['color']['text'], 5430 5430 'Blocks: text color with undefined var and fallback' 5431 5431 ); 5432 $this->assert Equals(5432 $this->assertSame( 5433 5433 $primary_color, 5434 5434 $styles['blocks']['core/comments']['color']['background'], … … 5436 5436 ); 5437 5437 5438 $this->assert Equals( $small_font, $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Block variations: font-size' );5439 $this->assert Equals( $secondary_color, $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Block variations: color' );5438 $this->assertSame( $small_font, $styles['blocks']['core/quote']['variations']['plain']['typography']['fontSize'], 'Block variations: font-size' ); 5439 $this->assertSame( $secondary_color, $styles['blocks']['core/quote']['variations']['plain']['color']['background'], 'Block variations: color' ); 5440 5440 /* 5441 5441 * As with wp_get_global_styles(), WP_Theme_JSON::resolve_variables may be called with merged data from … … 5446 5446 'Blocks: Post Template spacing.blockGap should be null' 5447 5447 ); 5448 $this->assert Equals(5448 $this->assertSame( 5449 5449 $spacing, 5450 5450 $styles['blocks']['core/columns']['spacing']['blockGap'], … … 5472 5472 $actual = $func->invoke( null, 'custom', $selector ); 5473 5473 5474 $this->assert Equals( $expected, $actual );5474 $this->assertSame( $expected, $actual ); 5475 5475 } 5476 5476 … … 5585 5585 ); 5586 5586 5587 $this->assert Equals( $expected, $actual );5587 $this->assertSame( $expected, $actual ); 5588 5588 } 5589 5589 … … 5622 5622 $button_variations = $block_nodes[0]['variations'] ?? array(); 5623 5623 5624 $this->assert Equals( array(), $button_variations );5624 $this->assertSame( array(), $button_variations ); 5625 5625 } 5626 5626 … … 5666 5666 ); 5667 5667 5668 $this->assert Equals( $expected, $button_variations );5668 $this->assertSame( $expected, $button_variations ); 5669 5669 } 5670 5670 }
Note: See TracChangeset
for help on using the changeset viewer.