Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / the-video-element / intrinsicsize / intrinsicsize-without-unsized-media.tentative.https.sub.html
1 <!DOCTYPE html>
2 <body>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script>
6 'use strict';
7
8 promise_test(async() => {
9   var video = document.createElement('video');
10   document.body.appendChild(video);
11   video.src = "/images/pattern.ogv";
12   await new Promise(resolve =>
13     video.addEventListener('canplaythrough', () => resolve(), {once: true}));
14   video.intrinsicSize = '400 x 500';
15   assert_equals(video.getBoundingClientRect().width, 400, 'width');
16   assert_equals(video.getBoundingClientRect().height, 500, 'height');
17   assert_equals(video.videoWidth, 400, 'naturalWidth');
18   assert_equals(video.videoHeight, 500, 'naturalHeight');
19
20   video.width = '800';
21   assert_equals(video.getBoundingClientRect().width, 800, 'width');
22   assert_equals(video.getBoundingClientRect().height, 1000, 'height');
23   assert_equals(video.videoWidth, 400, 'naturalWidth');
24   assert_equals(video.videoHeight, 500, 'naturalHeight');
25
26   video.style = 'height:800px;';
27   assert_equals(video.getBoundingClientRect().width, 800, 'width');
28   assert_equals(video.getBoundingClientRect().height, 800, 'height');
29   assert_equals(video.videoWidth, 400, 'naturalWidth');
30   assert_equals(video.videoHeight, 500, 'naturalHeight');
31
32   video.removeAttribute('width');
33   assert_equals(video.getBoundingClientRect().width, 640, 'width');
34   assert_equals(video.getBoundingClientRect().height, 800, 'height');
35   assert_equals(video.videoWidth, 400, 'naturalWidth');
36   assert_equals(video.videoHeight, 500, 'naturalHeight');
37 }, 'Test intrinsicsize for html video element');
38 </script>
39 </body>