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-svg.tentative.html
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <meta name="timeout" content="long">
4 <title>SVGImageElement.prototype.decode(), attach to DOM before promise resolves.</title>
5 <link rel=help href="https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode">
6 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8 <svg></svg>
9 <script>
10 "use strict";
11
12 promise_test(function() {
13   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
14   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
15   const promise = img.decode().then(function(arg) {
16     assert_equals(arg, undefined);
17   });
18   // Don't wait for the promise to resolve before attaching the image.
19   // The promise should still resolve successfully.
20   document.querySelector('svg').appendChild(img);
21   return promise;
22 }, document.title);
23 </script>