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

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/contenteditable-selection.html

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 4
5 <div id="main" role="main"> 5 <div id="main" role="main">
6 6
7 <div id="contenteditable-textbox" role="textbox" contenteditable="true"> 7 <div id="contenteditable-textbox" role="textbox" contenteditable="true">
8 <div id="contenteditable-line1">Line 1</div> 8 <div id="contenteditable-line1">Line 1</div>
9 <textarea id="contenteditable-line2" rows="1" cols="40">Line 2</textarea > 9 <textarea id="contenteditable-line2" rows="1" cols="40">Line 2</textarea >
10 </div> 10 </div>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 selection.removeAllRanges(); 72 selection.removeAllRanges();
73 selection.addRange(selectionRange); 73 selection.addRange(selectionRange);
74 74
75 assert_equals(contenteditableAccessible.selectionStart, 0); 75 assert_equals(contenteditableAccessible.selectionStart, 0);
76 assert_equals(contenteditableAccessible.selectionEnd, 21); 76 assert_equals(contenteditableAccessible.selectionEnd, 21);
77 77
78 // 7 for line1 + 1 for the textarea + 1 for the blank line. 78 // 7 for line1 + 1 for the textarea + 1 for the blank line.
79 assert_equals(mainAccessible.selectionStart, 9); 79 assert_equals(mainAccessible.selectionStart, 9);
80 assert_equals(mainAccessible.selectionEnd, 30); 80 assert_equals(mainAccessible.selectionEnd, 30);
81 81
82 assert_equals(rootAccessible.selectionAnchorObject.stringValue, 82 assert_equals(rootAccessible.selectionAnchorObject.name,
83 "AXValue: " + line1.textContent); 83 line1.textContent);
84 assert_equals(rootAccessible.selectionAnchorOffset, 0); 84 assert_equals(rootAccessible.selectionAnchorOffset, 0);
85 assert_equals(rootAccessible.selectionFocusObject.stringValue, 85 assert_equals(rootAccessible.selectionFocusObject.name,
86 "AXValue: " + line3.textContent); 86 line3.textContent);
87 assert_equals(rootAccessible.selectionFocusOffset, 6); 87 assert_equals(rootAccessible.selectionFocusOffset, 6);
88 }, "Test selectNodeContents on a contenteditable."); 88 }, "Test selectNodeContents on a contenteditable.");
89 </script> 89 </script>
90 90
91 <script> 91 <script>
92 test(function() 92 test(function()
93 { 93 {
94 var selection = window.getSelection(); 94 var selection = window.getSelection();
95 var selectionRange = document.createRange(); 95 var selectionRange = document.createRange();
96 var mainAccessible = accessibilityController.accessibleElementById("main "); 96 var mainAccessible = accessibilityController.accessibleElementById("main ");
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 selectionRange.selectNode(contenteditableLines[i]); 229 selectionRange.selectNode(contenteditableLines[i]);
230 selection.removeAllRanges(); 230 selection.removeAllRanges();
231 selection.addRange(selectionRange); 231 selection.addRange(selectionRange);
232 232
233 assert_equals(contenteditableAccessible.selectionStart, start); 233 assert_equals(contenteditableAccessible.selectionStart, start);
234 assert_equals(contenteditableAccessible.selectionEnd, end); 234 assert_equals(contenteditableAccessible.selectionEnd, end);
235 235
236 assert_equals(mainAccessible.selectionStart, start + 9); 236 assert_equals(mainAccessible.selectionStart, start + 9);
237 assert_equals(mainAccessible.selectionEnd, end + 9); 237 assert_equals(mainAccessible.selectionEnd, end + 9);
238 238
239 assert_equals(rootAccessible.selectionAnchorObject.stringValue, 239 assert_equals(rootAccessible.selectionAnchorObject.name,
240 "AXValue: " + contenteditableLines[i].textContent); 240 contenteditableLines[i].textContent);
241 assert_equals(rootAccessible.selectionAnchorOffset, 0); 241 assert_equals(rootAccessible.selectionAnchorOffset, 0);
242 assert_equals(rootAccessible.selectionFocusObject.stringValue, 242 assert_equals(rootAccessible.selectionFocusObject.name,
243 "AXValue: " + contenteditableLines[i].textContent); 243 contenteditableLines[i].textContent);
244 assert_equals(rootAccessible.selectionFocusOffset, 6); 244 assert_equals(rootAccessible.selectionFocusOffset, 6);
245 } 245 }
246 246
247 // For a sanity check, try the same test with contenteditable="false ". 247 // For a sanity check, try the same test with contenteditable="false ".
248 contenteditable.contenteditable = false; 248 contenteditable.contenteditable = false;
249 } 249 }
250 250
251 }, "The effects of the selectNode method should be reflected in the accessib ility API."); 251 }, "The effects of the selectNode method should be reflected in the accessib ility API.");
252 </script> 252 </script>
253 253
254 <script> 254 <script>
255 if (window.testRunner) 255 if (window.testRunner)
256 document.getElementById("main").style.display = "none";; 256 document.getElementById("main").style.display = "none";;
257 </script> 257 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698