Skip to content

Commit

Permalink
fix : fix broken atts - autoplay, muted, playsInline, loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ta5r committed Sep 25, 2024
1 parent 6c8ffb6 commit b4d3c5b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/unit/CoreVideoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function setUp(): void {
public function tearDown(): void {
// your tear down methods here
wp_delete_post( $this->post_id, true );

parent::tearDown();

\WPGraphQL::clear_schema();
Expand Down Expand Up @@ -88,7 +89,7 @@ public function test_retrieve_core_video_attributes(): void {
$block_content = '
<!-- wp:video {"id":1636,"align":"wide","lock":{"move":true,"remove":true},"className":"test-css-class"} -->
<figure id="test-anchor" class="wp-block-video" style="margin-top:var(--wp--preset--spacing--50);margin-right:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);margin-left:var(--wp--preset--spacing--50)">
<video autoplay loop muted poster="http://mysite.local/wp-content/uploads/2023/05/pexels-egor-komarov-14420089-scaled.jpg" preload="auto" src="http://mysite.local/wp-content/uploads/2023/07/pexels_videos_1860684-1440p.mp4" playsinline></video>
<video autoplay controls loop muted poster="http://mysite.local/wp-content/uploads/2023/05/pexels-egor-komarov-14420089-scaled.jpg" preload="auto" src="http://mysite.local/wp-content/uploads/2023/07/pexels_videos_1860684-1440p.mp4" playsinline></video>
<figcaption class="wp-element-caption">Sample caption</figcaption></figure>
<!-- /wp:video -->';

Expand Down Expand Up @@ -131,17 +132,17 @@ public function test_retrieve_core_video_attributes(): void {
[
'align' => 'wide',
'anchor' => 'test-anchor',
'autoplay' => null, // @todo : 'autoplay' should be true.
'autoplay' => true,
'tracks' => [],
'muted' => null, // @todo : 'muted' should be true.
'muted' => true,
'caption' => 'Sample caption',
'className' => 'test-css-class',
'preload' => 'auto',
'src' => 'http://mysite.local/wp-content/uploads/2023/07/pexels_videos_1860684-1440p.mp4',
'style' => null, // @todo : 'style' should be '{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|50\",\"bottom\":\"var:preset|spacing|50\",\"left\":\"var:preset|spacing|50\",\"right\":\"var:preset|spacing|50\"}}}'.
'playsInline' => null, // @todo : 'playsInline' should be true.
'playsInline' => true,
'controls' => true,
'loop' => null, // @todo : 'loop' should be true.
'loop' => true,
'lock' => wp_json_encode(
[
'move' => true,
Expand Down Expand Up @@ -205,7 +206,7 @@ public function test_retrieve_core_video_tracks_attribute(): void {

$this->assertCount( 1, $tracks );
$this->assertEquals(
wp_json_encode(
wp_json_encode( // Previously untested.
[
'src' => 'https://example.com/subtitles.vtt',
'kind' => 'subtitles',
Expand Down

0 comments on commit b4d3c5b

Please sign in to comment.