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

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

Issue 1942953003: Accessible setSelection function should use VisiblePositions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4
5 <div id="main" role="main">
6
7 <div id="editable1" contenteditable="true">Hello1</div>
8
9 <div id="editable2" contenteditable="true"> Hello2 </div>
10
11 </div>
12
13 <script>
14 test(function()
15 {
16 var axEditable1 = accessibilityController.accessibleElementById("editabl e1");
17 var axTextNode1 = axEditable1.childAtIndex(0);
18 assert_equals(axTextNode1.name, "Hello1");
19 axTextNode1.setSelectedTextRange(0, 6);
20
21 var selection = window.getSelection();
22 var range = selection.getRangeAt(0);
23 assert_equals(range.toString(), "Hello1");
24
25 var editable1 = document.getElementById("editable1");
26 var textNode1 = editable1.firstChild;
27 assert_equals(range.startContainer, textNode1);
28 assert_equals(range.startOffset, 0);
29 assert_equals(range.endContainer, textNode1);
30 assert_equals(range.endOffset, 6);
31 }, "Using accessible APIs to set selection works when there's no extra white space.");
32
33 test(function()
34 {
35 var axEditable2 = accessibilityController.accessibleElementById("editabl e2");
36 var axTextNode2 = axEditable2.childAtIndex(0);
37 assert_equals(axTextNode2.name, "Hello2");
38 axTextNode2.setSelectedTextRange(0, 6);
David Tseng 2016/05/02 23:38:55 Can you also test setting selection on the contain
dmazzoni 2016/05/13 21:42:55 Done.
39
40 var selection = window.getSelection();
41 var range = selection.getRangeAt(0);
42 assert_equals(range.toString(), "Hello2");
43
44 var editable2 = document.getElementById("editable2");
45 var textNode2 = editable2.firstChild;
46 assert_equals(range.startContainer, textNode2);
47 assert_equals(range.startOffset, 2);
48 assert_equals(range.endContainer, textNode2);
49 assert_equals(range.endOffset, 8);
50 }, "Using accessible APIs to set selection works even with non-visible white space.");
51 </script>
52
53 <script>
54 if (window.testRunner)
55 document.getElementById("main").style.display = "none";;
56 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698