diff options
Diffstat (limited to 'tests/wpt/tests/html/semantics/embedded-content/the-img-element/update-the-image-data/not-broken-while-load-task-scheduled.html')
-rw-r--r-- | tests/wpt/tests/html/semantics/embedded-content/the-img-element/update-the-image-data/not-broken-while-load-task-scheduled.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wpt/tests/html/semantics/embedded-content/the-img-element/update-the-image-data/not-broken-while-load-task-scheduled.html b/tests/wpt/tests/html/semantics/embedded-content/the-img-element/update-the-image-data/not-broken-while-load-task-scheduled.html new file mode 100644 index 00000000000..82b860a4700 --- /dev/null +++ b/tests/wpt/tests/html/semantics/embedded-content/the-img-element/update-the-image-data/not-broken-while-load-task-scheduled.html @@ -0,0 +1,31 @@ +<!doctype html> +<title>Image shouldn't be broken while load task is scheduled.</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +async function run_test(prop) { + let img = new Image(); + img.width = 50; + img.height = 50; + img.alt = "Anything non-empty"; + img[prop] = `/images/green.png?not-broken-while-load-task-scheduled-` + Math.random(); + let load = new Promise(r => img.addEventListener("load", r, { once: true })); + document.body.appendChild(img); + + assert_equals(img.clientWidth, 50, "clientWidth"); + assert_equals(img.clientHeight, 50, "clientHeight"); + assert_equals(getComputedStyle(img).height, "50px", "Computed height"); + assert_equals(getComputedStyle(img).width, "50px", "Computed height"); + + await load; + + assert_equals(img.clientWidth, 50, "clientWidth"); + assert_equals(img.clientHeight, 50, "clientHeight"); + assert_equals(getComputedStyle(img).height, "50px", "Computed height"); + assert_equals(getComputedStyle(img).width, "50px", "Computed height"); +} + +promise_test(() => run_test("src")); +promise_test(() => run_test("srcset")); +</script> |