Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 | |
| 5 <style> | |
| 6 .hideAllContainers .container { | |
| 7 display: none; | |
| 8 } | |
| 9 </style> | |
| 10 | |
| 11 <div class="container"> | |
| 12 <button id="labelOnly" aria-label="Label">Contents</button> | |
| 13 </div> | |
| 14 | |
| 15 <script> | |
| 16 test(function(t){ | |
|
dmazzoni
2015/06/05 19:46:01
Nit: space between ")" and "{" (and more below)
aboxhall
2015/06/05 19:53:57
Done.
| |
| 17 var axLabelOnly = accessibilityController.accessibleElementById("labelOnly") ; | |
| 18 assert_equals(axLabelOnly.name, "Label"); | |
| 19 assert_equals(axLabelOnly.nameFrom, "attribute"); | |
| 20 }, "Button with aria-label."); | |
| 21 </script> | |
| 22 | |
| 23 <div class="container"> | |
| 24 <button id="emptyLabel1" aria-label="">Contents</button> | |
| 25 </div> | |
| 26 | |
| 27 <script> | |
| 28 test(function(t){ | |
| 29 var axEmptyLabel1 = accessibilityController.accessibleElementById("emptyLabe l1"); | |
| 30 assert_equals(axEmptyLabel1.name, "Contents"); | |
| 31 assert_equals(axEmptyLabel1.nameFrom, "contents"); | |
| 32 }, "Button with explicitly empty label."); | |
| 33 </script> | |
| 34 | |
| 35 <div class="container"> | |
| 36 <button id="emptyLabel2" aria-label>Contents</button> | |
| 37 </div> | |
| 38 | |
| 39 <script> | |
| 40 test(function(t){ | |
| 41 var axEmptyLabel2 = accessibilityController.accessibleElementById("emptyLabe l2"); | |
| 42 assert_equals(axEmptyLabel2.name, "Contents"); | |
| 43 assert_equals(axEmptyLabel2.nameFrom, "contents"); | |
| 44 }, "Button with label value not specified."); | |
| 45 </script> | |
| 46 | |
| 47 <div class="container"> | |
| 48 <button id="labelledby1" aria-labelledby="label1" aria-label="Label">Content s</button> | |
| 49 <div id="label1">Labelledby 1</div> | |
| 50 </div> | |
| 51 | |
| 52 <script> | |
| 53 test(function(t){ | |
| 54 var axLabelledby1 = accessibilityController.accessibleElementById("labelledb y1"); | |
| 55 assert_equals(axLabelledby1.name, "Labelledby 1"); | |
| 56 assert_equals(axLabelledby1.nameFrom, "relatedElement"); | |
| 57 assert_equals(axLabelledby1.nameElementCount(), 1); | |
| 58 assert_equals(axLabelledby1.nameElementAtIndex(0).role, "AXRole: AXDiv"); | |
| 59 }, "aria-labelledby trumps both aria-label and contents."); | |
| 60 </script> | |
| 61 | |
| 62 <div class="container"> | |
| 63 <button id="labelledby2" aria-labelledby="label2">Contents</button> | |
| 64 <div id="label2" aria-label="Label 2 label">Contents 2</div> | |
| 65 </div> | |
| 66 | |
| 67 <script> | |
| 68 test(function(t){ | |
| 69 var axLabelledby2 = accessibilityController.accessibleElementById("labelledb y2"); | |
| 70 assert_equals(axLabelledby2.name, "Label 2 label"); | |
| 71 assert_equals(axLabelledby2.nameFrom, "relatedElement"); | |
| 72 assert_equals(axLabelledby2.nameElementCount(), 1); | |
| 73 assert_equals(axLabelledby2.nameElementAtIndex(0).role, "AXRole: AXDiv"); | |
| 74 }, "Button with aria-labelledby referencing an element with an aria-label uses t he aria-label as text alternative."); | |
| 75 </script> | |
| 76 | |
| 77 <div class="container"> | |
| 78 <button id="labelledby3" aria-labelledby="label3">Contents</button> | |
| 79 <div id="label3" aria-label="">Contents 3</div> | |
| 80 </div> | |
| 81 | |
| 82 <script> | |
| 83 test(function(t){ | |
| 84 var axLabelledby3 = accessibilityController.accessibleElementById("labelledb y3"); | |
| 85 assert_equals(axLabelledby3.name, "Contents 3"); | |
| 86 assert_equals(axLabelledby3.nameFrom, "relatedElement"); | |
| 87 assert_equals(axLabelledby3.nameElementCount(), 1); | |
| 88 assert_equals(axLabelledby3.nameElementAtIndex(0).role, "AXRole: AXDiv"); | |
| 89 }, "aria-labelledby reference to element with empty aria-label."); | |
| 90 </script> | |
| 91 | |
| 92 <div class="container"> | |
| 93 <button id="labelledby4" aria-labelledby="label4">Contents</button> | |
| 94 <div id="label4" aria-label="Label 4 Label" aria-labelledby="label4chained"> Contents 4</div> | |
| 95 <p id="label4chained">Contents 4 chained</p> | |
| 96 </div> | |
| 97 | |
| 98 <script> | |
| 99 test(function(t){ | |
| 100 var axLabelledby4 = accessibilityController.accessibleElementById("labelledb y4"); | |
| 101 assert_equals(axLabelledby4.name, "Label 4 Label"); | |
| 102 assert_equals(axLabelledby4.nameFrom, "relatedElement"); | |
| 103 assert_equals(axLabelledby4.nameElementCount(), 1); | |
| 104 assert_equals(axLabelledby4.nameElementAtIndex(0).role, "AXRole: AXDiv"); | |
| 105 }, "Button with chain of aria-labelledby references."); | |
|
dmazzoni
2015/06/05 19:46:01
Could you maybe make it clear that the aria-labell
aboxhall
2015/06/05 19:53:56
Fixed up the test title, thanks.
| |
| 106 </script> | |
| 107 | |
| 108 <script> | |
| 109 if (window.testRunner) | |
| 110 document.body.className = "hideAllContainers"; | |
| 111 </script> | |
| OLD | NEW |