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

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

Issue 1948213002: Add a |skipInitialAncestry| option to tree walking. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs
index 73f1cdbeed87b403298c4922c9e0ba385dd7ad24..5b91ad396a37edd9a5d3cfaf15a284ebe4413b90 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker_test.extjs
@@ -136,6 +136,25 @@ TEST_F('AutomationTreeWalkerTest', 'RootLeafRestriction', function() {
while (walker.next().node) {}
assertEquals('532', visited);
+ // Test not visiting ancestors of initial node.
+ var node5 = r.firstChild.firstChild.lastChild;
+ assertEquals('5', node5.name);
+ restrictions.root = function(n) { return n.name == '1'; };
+ restrictions.leaf = function(n) { return !n.firstChild; };
+
+ visited = '';
+ restrictions.skipInitialAncestry = false;
+ walker = new AutomationTreeWalker(node5, 'backward', restrictions);
+ while (walker.next().node) {}
+ assertEquals('4321', visited);
+
+ // 2 and 1 are ancestors; check they get skipped.
+ visited = '';
+ restrictions.skipInitialAncestry = true;
+ walker = new AutomationTreeWalker(node5, 'backward', restrictions);
+ while (walker.next().node) {}
+ assertEquals('43', visited);
+
// We should skip node 2's subtree.
walker = new AutomationTreeWalker(
node2, 'forward', {skipInitialSubtree: true});
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/tree_walker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698