Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / the-img-element / decode / image-decode-with-quick-attach.html
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <meta name="timeout" content="long">
4 <title>HTMLImageElement.prototype.decode(), attach to DOM before promise resolves.</title>
5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
6 <link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9
10 <body></body>
11
12 <script>
13 "use strict";
14
15 promise_test(function() {
16   const img = new Image();
17   img.src = "/images/green.png";
18   const promise = img.decode().then(function(arg) {
19     assert_equals(arg, undefined);
20   });
21   // Don't wait for the promise to resolve before attaching the image.
22   // The promise should still resolve successfully.
23   document.body.appendChild(img);
24   return promise;
25 }, document.title);
26 </script>