Skip to content

Commit

Permalink
Add tests for fluid layout + typography (#53554)
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Aug 15, 2023
1 parent a3d7887 commit 9b939ff
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,16 @@ describe( 'typography utils', () => {
},
expected: { fluid: { maxViewPortWidth: '10px' } },
},
{
message: 'should not merge `layout.wideSize` if it is fluid',
settings: {
typography: { fluid: { minFontSize: '16px' } },
layout: { wideSize: 'clamp(1000px, 85vw, 2000px)' },
},
expected: {
fluid: { minFontSize: '16px' },
},
},
].forEach( ( { message, settings, expected } ) => {
it( `${ message }`, () => {
expect(
Expand Down
5 changes: 5 additions & 0 deletions phpunit/block-supports/typography-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ public function data_generate_block_supports_font_size_fixtures() {
'theme_slug' => 'block-theme-child-with-fluid-typography-config',
'expected_output' => 'font-size:15px;',
),
'returns clamp value using default config if layout is fluid' => array(
'font_size_value' => '15px',
'theme_slug' => 'block-theme-child-with-fluid-layout',
'expected_output' => 'font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.078), 15px);',
),
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Theme Name: Block Theme Child Theme With Fluid Layout
Theme URI: https://wordpress.org/
Description: For testing purposes only.
Template: block-theme
Version: 1.0.0
Text Domain: block-theme-child-with-fluid-layout
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 2,
"settings": {
"appearanceTools": true,
"layout": {
"wideSize": "clamp(1000px, 85vw, 2000px)"
},
"typography": {
"fluid": true
}
}
}

0 comments on commit 9b939ff

Please sign in to comment.