Changeset 55946 for trunk/tests/phpunit/tests/block-supports/typography.php
- Timestamp:
- 06/20/2023 05:26:47 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-supports/typography.php
r55133 r55946 569 569 * @ticket 57065 570 570 * @ticket 57529 571 * @ticket 58522 571 572 * 572 573 * @covers ::wp_register_typography_support … … 639 640 'font_size_value' => '17px', 640 641 'theme_slug' => 'block-theme-child-with-fluid-typography-config', 641 'expected_output' => 'font-size:clamp(16px, 1rem + ((1vw - 7.68px) * 0. 12), 17px);',642 'expected_output' => 'font-size:clamp(16px, 1rem + ((1vw - 7.68px) * 0.431), 17px);', 642 643 ), 643 644 'returns value when font size <= custom min font size bound' => array( … … 848 849 ); 849 850 } 851 852 /** 853 * Tests computed font size values. 854 * 855 * @ticket 58522 856 * 857 * @covers ::wp_get_computed_fluid_typography_value 858 * 859 * @dataProvider data_wp_get_computed_fluid_typography_value 860 * 861 * @param array $args { 862 * Optional. An associative array of values to calculate a fluid formula for font size. Default is empty array. 863 * 864 * @type string $maximum_viewport_width Maximum size up to which type will have fluidity. 865 * @type string $minimum_viewport_width Minimum viewport size from which type will have fluidity. 866 * @type string $maximum_font_size Maximum font size for any clamp() calculation. 867 * @type string $minimum_font_size Minimum font size for any clamp() calculation. 868 * @type int $scale_factor A scale factor to determine how fast a font scales within boundaries. 869 * } 870 * @param string $expected_output Expected value of style property from gutenberg_apply_typography_support(). 871 */ 872 public function test_wp_get_computed_fluid_typography_value( $args, $expected_output ) { 873 $actual = wp_get_computed_fluid_typography_value( $args ); 874 $this->assertSame( $expected_output, $actual ); 875 } 876 877 /** 878 * Data provider. 879 * 880 * @return array 881 */ 882 public function data_wp_get_computed_fluid_typography_value() { 883 return array( 884 'returns clamped value with valid args' => array( 885 'args' => array( 886 'minimum_viewport_width' => '320px', 887 'maximum_viewport_width' => '1000px', 888 'minimum_font_size' => '50px', 889 'maximum_font_size' => '100px', 890 'scale_factor' => 1, 891 ), 892 'expected_output' => 'clamp(50px, 3.125rem + ((1vw - 3.2px) * 7.353), 100px)', 893 ), 894 'returns `null` when `maximum_viewport_width` is an unsupported unit' => array( 895 'args' => array( 896 'minimum_viewport_width' => '320px', 897 'maximum_viewport_width' => 'calc(100% - 60px)', 898 'minimum_font_size' => '50px', 899 'maximum_font_size' => '100px', 900 'scale_factor' => 1, 901 ), 902 'expected_output' => null, 903 ), 904 'returns `null` when `minimum_viewport_width` is an unsupported unit' => array( 905 'args' => array( 906 'minimum_viewport_width' => 'calc(100% - 60px)', 907 'maximum_viewport_width' => '1000px', 908 'minimum_font_size' => '50px', 909 'maximum_font_size' => '100px', 910 'scale_factor' => 1, 911 ), 912 'expected_output' => null, 913 ), 914 'returns `null` when `minimum_font_size` is an unsupported unit' => array( 915 'args' => array( 916 'minimum_viewport_width' => '320em', 917 'maximum_viewport_width' => '1000em', 918 'minimum_font_size' => '10vw', 919 'maximum_font_size' => '100em', 920 'scale_factor' => 1, 921 ), 922 'expected_output' => null, 923 ), 924 'returns `null` when `maximum_font_size` is an unsupported unit' => array( 925 'args' => array( 926 'minimum_viewport_width' => '320em', 927 'maximum_viewport_width' => '1000em', 928 'minimum_font_size' => '50px', 929 'maximum_font_size' => '100%', 930 'scale_factor' => 1, 931 ), 932 'expected_output' => null, 933 ), 934 ); 935 } 850 936 } 937
Note: See TracChangeset
for help on using the changeset viewer.