Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: LayoutTests/accessibility/name-calc-img.html

Issue 1301993003: Last few steps of text alternative computation algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename isSameLayoutBox and fix infinite loop for label wrapped Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/accessibility/name-calc-img.html
diff --git a/LayoutTests/accessibility/name-calc-img.html b/LayoutTests/accessibility/name-calc-img.html
new file mode 100644
index 0000000000000000000000000000000000000000..d5467d158b175415a234d719cf785a87819e840a
--- /dev/null
+++ b/LayoutTests/accessibility/name-calc-img.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+
esprehn 2015/08/30 00:07:47 nice tests!
aboxhall 2015/08/30 22:25:21 Cheers! They found a bunch of bugs as I wrote them
+<style>
+.hideAllContainers .container {
+ display: none;
+}
+</style>
+
+<div class="container">
+ <img id="img1" src="resources/cake.png">
+</div>
+
+<script>
+test(function(t) {
+ var axImg1 = accessibilityController.accessibleElementById("img1");
+ assert_equals(axImg1.name, "");
+}, "img element without alt");
+</script>
+
+<div class="container">
+ <img id="img2" title="img2-title" src="resources/cake.png">
+</div>
+
+<script>
+test(function(t) {
+ var axImg2 = accessibilityController.accessibleElementById("img2");
+ assert_equals(axImg2.name, "img2-title");
+ assert_equals(axImg2.nameFrom, "attribute");
+}, "img element without alt, with title");
+</script>
+
+<div class="container">
+ <img id="img3" title="img3-title" alt="img3-alt" src="resources/cake.png">
+</div>
+
+<script>
+test(function(t) {
+ var axImg3 = accessibilityController.accessibleElementById("img3");
+ assert_equals(axImg3.name, "img3-alt");
+ assert_equals(axImg3.nameFrom, "attribute");
+}, "img element with title and alt");
+</script>
+
+<div class="container">
+ <img id="img4" title="img4-title" alt="img4-alt" aria-label="img4-aria-label" src="resources/cake.png">
+</div>
+
+<script>
+test(function(t) {
+ var axImg4 = accessibilityController.accessibleElementById("img4");
+ assert_equals(axImg4.name, "img4-aria-label");
+ assert_equals(axImg4.nameFrom, "attribute");
+}, "img element with title and alt");
+</script>
+
+<div class="container">
+ <img id="img5" title="img5-title" alt="img5-alt" aria-label="img5-aria-label" aria-labelledby="labelledby5" src="resources/cake.png">
+ <span hidden="true" id="labelledby5">img5-aria-labelledby</span>
+</div>
+
+<script>
+test(function(t) {
+ var axImg5 = accessibilityController.accessibleElementById("img5");
+ assert_equals(axImg5.name, "img5-aria-labelledby");
+ assert_equals(axImg5.nameFrom, "relatedElement");
+}, "img element with title and alt");
+</script>
+
+<script>
+if (window.testRunner)
+ document.body.className = "hideAllContainers";
+</script>

Powered by Google App Engine
This is Rietveld 408576698