Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for fluid layout + typography #53554

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,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
}
}
}
Loading