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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs

Issue 2948173004: Fix end of line announcements (Closed)
Patch Set: Created 3 years, 6 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: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
index fd8243cea91bd8202c1642b4ed6809c2384b44be..f0b8a9e1b22df15a8b543fbca5132dd3898cf95c 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
@@ -462,3 +462,54 @@ TEST_F('CursorsTest', 'ContentEquality', function() {
assertFalse(inlineTextBoxRange.contentEquals(rootRange));
});
});
+
+TEST_F('CursorsTest', 'DeepEquivalency', function() {
+ this.runWithLoadedTree(function() {/*!
+ <p style="word-spacing:100000px">this is a test</p>
+ */}, function(root) {
+ var textNode = root.find({role: RoleType.STATIC_TEXT});
+
+ var text = new cursors.Cursor(textNode, 2);
+ deep = text.deepEquivalent;
+ assertEquals('this ', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(2, deep.index);
+
+ text = new cursors.Cursor(textNode, 5);
+ deep = text.deepEquivalent;
+ assertEquals('is ', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(0, deep.index);
+
+ text = new cursors.Cursor(textNode, 7);
+ deep = text.deepEquivalent;
+ assertEquals('is ', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(2, deep.index);
+
+ text = new cursors.Cursor(textNode, 8);
+ deep = text.deepEquivalent;
+ assertEquals('a ', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(0, deep.index);
+
+ text = new cursors.Cursor(textNode, 11);
+ deep = text.deepEquivalent;
+ assertEquals('test', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(1, deep.index);
+
+ // This is the only selection that can be placed at the length of the node's
+ // text. This only happens at the end of a line.
+ text = new cursors.Cursor(textNode, 14);
+ deep = text.deepEquivalent;
+ assertEquals('test', deep.node.name);
+ assertEquals(RoleType.INLINE_TEXT_BOX, deep.node.role);
+ assertEquals(4, deep.index);
+
+ // However, any offset larger is invalid.
+ text = new cursors.Cursor(textNode, 15);
+ deep = text.deepEquivalent;
+ assertTrue(text.equals(deep));
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698