Skip to content

Commit

Permalink
updating tests, remove hanging isset
Browse files Browse the repository at this point in the history
test
  • Loading branch information
ramonjd committed Feb 20, 2024
1 parent 1f6e596 commit 03a7b0d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function gutenberg_get_typography_font_size_value( $preset, $settings = array()
$global_settings
);
$typography_settings = isset( $settings['typography'] ) ? $settings['typography'] : array();
$should_use_fluid_typography = isset( $typography_settings['fluid'] ) && ! empty( $typography_settings['fluid'] );
$should_use_fluid_typography = ! empty( $typography_settings['fluid'] );

if ( ! $should_use_fluid_typography ) {
return $preset['size'];
Expand Down
4 changes: 2 additions & 2 deletions phpunit/block-supports/typography-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@ public function data_generate_font_size_preset_fixtures() {
'expected_output' => null,
),

'returns value when fluid config is empty`' => array(
'returns value when fluid is `false`' => array(

Check warning on line 358 in phpunit/block-supports/typography-test.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Array double arrow not aligned correctly; expected 8 space(s) between "'returns value when fluid is `false`'" and double arrow, but found 2.
'font_size' => array(
'size' => '28px',
'fluid' => false,
),
'settings' => array(
'typography' => array(
'fluid' => true,
'fluid' => false,
),
),
'expected_output' => '28px',
Expand Down
3 changes: 2 additions & 1 deletion phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1445,12 +1445,13 @@ public function test_get_stylesheet_generates_fluid_typography_values() {
'default'
);

unregister_block_type( 'test/clamp-me' );

// Results also include root site blocks styles.
$this->assertSame(
'body{--wp--preset--font-size--pickles: clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.156), 16px);--wp--preset--font-size--toast: clamp(14.642px, 0.915rem + ((1vw - 3.2px) * 0.575), 22px);}body { margin: 0; }.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; }:where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}body .is-layout-flow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-constrained > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-constrained > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){max-width: var(--wp--style--global--content-size);margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignwide{max-width: var(--wp--style--global--wide-size);}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}body .is-layout-flex > *{margin: 0;}body .is-layout-grid{display: grid;}body .is-layout-grid > *{margin: 0;}body{font-size: clamp(0.875em, 0.875rem + ((1vw - 0.2em) * 0.156), 1em);}h1{font-size: clamp(50.171px, 3.136rem + ((1vw - 3.2px) * 3.893), 100px);}.wp-block-test-clamp-me{font-size: clamp(27.894px, 1.743rem + ((1vw - 3.2px) * 1.571), 48px);}.has-pickles-font-size{font-size: var(--wp--preset--font-size--pickles) !important;}.has-toast-font-size{font-size: var(--wp--preset--font-size--toast) !important;}',
$theme_json->get_stylesheet()
);
unregister_block_type( 'test/clamp-me' );
}

public function test_allow_indirect_properties() {
Expand Down

0 comments on commit 03a7b0d

Please sign in to comment.