Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 | |
|
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
| |
| 5 <style> | |
| 6 .hideAllContainers .container { | |
| 7 display: none; | |
| 8 } | |
| 9 </style> | |
| 10 | |
| 11 <div class="container"> | |
| 12 <img id="img1" src="resources/cake.png"> | |
| 13 </div> | |
| 14 | |
| 15 <script> | |
| 16 test(function(t) { | |
| 17 var axImg1 = accessibilityController.accessibleElementById("img1"); | |
| 18 assert_equals(axImg1.name, ""); | |
| 19 }, "img element without alt"); | |
| 20 </script> | |
| 21 | |
| 22 <div class="container"> | |
| 23 <img id="img2" title="img2-title" src="resources/cake.png"> | |
| 24 </div> | |
| 25 | |
| 26 <script> | |
| 27 test(function(t) { | |
| 28 var axImg2 = accessibilityController.accessibleElementById("img2"); | |
| 29 assert_equals(axImg2.name, "img2-title"); | |
| 30 assert_equals(axImg2.nameFrom, "attribute"); | |
| 31 }, "img element without alt, with title"); | |
| 32 </script> | |
| 33 | |
| 34 <div class="container"> | |
| 35 <img id="img3" title="img3-title" alt="img3-alt" src="resources/cake.png"> | |
| 36 </div> | |
| 37 | |
| 38 <script> | |
| 39 test(function(t) { | |
| 40 var axImg3 = accessibilityController.accessibleElementById("img3"); | |
| 41 assert_equals(axImg3.name, "img3-alt"); | |
| 42 assert_equals(axImg3.nameFrom, "attribute"); | |
| 43 }, "img element with title and alt"); | |
| 44 </script> | |
| 45 | |
| 46 <div class="container"> | |
| 47 <img id="img4" title="img4-title" alt="img4-alt" aria-label="img4-aria-label" src="resources/cake.png"> | |
| 48 </div> | |
| 49 | |
| 50 <script> | |
| 51 test(function(t) { | |
| 52 var axImg4 = accessibilityController.accessibleElementById("img4"); | |
| 53 assert_equals(axImg4.name, "img4-aria-label"); | |
| 54 assert_equals(axImg4.nameFrom, "attribute"); | |
| 55 }, "img element with title and alt"); | |
| 56 </script> | |
| 57 | |
| 58 <div class="container"> | |
| 59 <img id="img5" title="img5-title" alt="img5-alt" aria-label="img5-aria-label" aria-labelledby="labelledby5" src="resources/cake.png"> | |
| 60 <span hidden="true" id="labelledby5">img5-aria-labelledby</span> | |
| 61 </div> | |
| 62 | |
| 63 <script> | |
| 64 test(function(t) { | |
| 65 var axImg5 = accessibilityController.accessibleElementById("img5"); | |
| 66 assert_equals(axImg5.name, "img5-aria-labelledby"); | |
| 67 assert_equals(axImg5.nameFrom, "relatedElement"); | |
| 68 }, "img element with title and alt"); | |
| 69 </script> | |
| 70 | |
| 71 <script> | |
| 72 if (window.testRunner) | |
| 73 document.body.className = "hideAllContainers"; | |
| 74 </script> | |
| OLD | NEW |