Ticket #54788: 54788-4.patch
File 54788-4.patch, 3.1 KB (added by , 2 years ago) |
---|
-
src/wp-includes/media.php
3219 3219 * @type string $poster The 'poster' attribute for the `<video>` element. Default empty. 3220 3220 * @type string $loop The 'loop' attribute for the `<video>` element. Default empty. 3221 3221 * @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty. 3222 * @type string $muted The 'muted' attribute for the `<video>` element. Default false. 3222 3223 * @type string $preload The 'preload' attribute for the `<video>` element. 3223 3224 * Default 'metadata'. 3224 3225 * @type string $class The 'class' attribute for the `<video>` element. … … 3263 3264 'poster' => '', 3264 3265 'loop' => '', 3265 3266 'autoplay' => '', 3267 'muted' => 'false', 3266 3268 'preload' => 'metadata', 3267 3269 'width' => 640, 3268 3270 'height' => 360, … … 3390 3392 'poster' => esc_url( $atts['poster'] ), 3391 3393 'loop' => wp_validate_boolean( $atts['loop'] ), 3392 3394 'autoplay' => wp_validate_boolean( $atts['autoplay'] ), 3395 'muted' => wp_validate_boolean( $atts['muted'] ), 3393 3396 'preload' => $atts['preload'], 3394 3397 ); 3395 3398 3396 3399 // These ones should just be omitted altogether if they are blank. 3397 foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {3400 foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'muted' ) as $a ) { 3398 3401 if ( empty( $html_atts[ $a ] ) ) { 3399 3402 unset( $html_atts[ $a ] ); 3400 3403 } -
tests/phpunit/tests/media.php
1023 1023 1024 1024 /** 1025 1025 * @ticket 35367 1026 * @ticket 54788 1026 1027 * @depends test_video_shortcode_body 1027 1028 */ 1028 1029 public function test_wp_video_shortcode_attributes() { … … 1035 1036 $this->assertStringContainsString( 'src="https://example.com/foo.mp4', $actual ); 1036 1037 $this->assertStringNotContainsString( 'loop', $actual ); 1037 1038 $this->assertStringNotContainsString( 'autoplay', $actual ); 1039 $this->assertStringNotContainsString( 'muted', $actual ); 1038 1040 $this->assertStringContainsString( 'preload="metadata"', $actual ); 1039 1041 $this->assertStringContainsString( 'width="640"', $actual ); 1040 1042 $this->assertStringContainsString( 'height="360"', $actual ); … … 1046 1048 'poster' => 'https://example.com/foo.png', 1047 1049 'loop' => true, 1048 1050 'autoplay' => true, 1051 'muted' => true, 1049 1052 'preload' => true, 1050 1053 'width' => 123, 1051 1054 'height' => 456, … … 1057 1060 $this->assertStringContainsString( 'poster="https://example.com/foo.png', $actual ); 1058 1061 $this->assertStringContainsString( 'loop="1"', $actual ); 1059 1062 $this->assertStringContainsString( 'autoplay="1"', $actual ); 1063 $this->assertStringContainsString( 'muted', $actual ); 1060 1064 $this->assertStringContainsString( 'preload="1"', $actual ); 1061 1065 $this->assertStringContainsString( 'width="123"', $actual ); 1062 1066 $this->assertStringContainsString( 'height="456"', $actual );