diff options
Diffstat (limited to 'testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html')
-rw-r--r-- | testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html new file mode 100644 index 0000000000..3cc06d6c85 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>Images with an empty alt attribute have an intrinsic size of zero</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + img { + width: 50px; + height: auto; + } +</style> +<img src="broken"> +<img src="broken" alt="non-empty"> +<img src="broken" alt=""> +<script> +const t = async_test("Images with an empty alt attribute have an intrinsic size of zero"); +onload = t.step_func_done(function() { + for (const img of document.querySelectorAll("img")) { + const alt = img.getAttribute("alt"); + const shouldTakeUpSpace = alt == null || alt.length > 0; + (shouldTakeUpSpace ? assert_not_equals : assert_equals)(img.offsetHeight, 0, img.outerHTML); + } +}); +</script> |