Make WordPress Core


Ignore:
Timestamp:
01/23/2024 05:55:49 AM (2 years ago)
Author:
isabel_brison
Message:

Editor: fix fluid font division by zero error when min and max viewport widths are equal.

Fixes a division error by returning null when minViewportWidth - maxViewportWidth is zero in wp_get_computed_fluid_typography_value.

Props ramonopoly, mukesh27, andrewserong, audrasjb.
Fixes #60263.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-supports/typography.php

    r56536 r57329  
    914914     *
    915915     * @ticket 58522
     916     * @ticket 60263
    916917     *
    917918     * @covers ::wp_get_computed_fluid_typography_value
     
    952953                'expected_output' => 'clamp(50px, 3.125rem + ((1vw - 3.2px) * 7.353), 100px)',
    953954            ),
     955            'returns `null` when maximum and minimum viewport width are equal' => array(
     956                'args'            => array(
     957                    'minimum_viewport_width' => '800px',
     958                    'maximum_viewport_width' => '800px',
     959                    'minimum_font_size'      => '50px',
     960                    'maximum_font_size'      => '100px',
     961                    'scale_factor'           => 1,
     962                ),
     963                'expected_output' => null,
     964            ),
    954965            'returns `null` when `maximum_viewport_width` is an unsupported unit' => array(
    955966                'args'            => array(
Note: See TracChangeset for help on using the changeset viewer.