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

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

Issue 2333533003: Add a |contentEquals| method to cursors and ranges. (Closed)
Patch Set: Add a |contentEquals| method to cursors and ranges. Created 4 years, 3 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 aafc9416274ec69a6d7f24caa1fcf4e2741db9a5..1bcc45ea687c549b486dcf8849c5216a987e11ae 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs
@@ -426,3 +426,35 @@ TEST_F('CursorsTest', 'InlineElementOffset', function() {
oRange.select();
});
});
+
+TEST_F('CursorsTest', 'ContentEquality', function() {
+ this.runWithLoadedTree(function() {/*!
+ <div role="region">this is a test</button>
+ */}, function(root) {
+ var region = root.firstChild;
+ assertEquals(RoleType.region, region.role);
+ var staticText = region.firstChild;
+ assertEquals(RoleType.staticText, staticText.role);
+ var inlineTextBox = staticText.firstChild;
+ assertEquals(RoleType.inlineTextBox, inlineTextBox.role);
+
+ var rootRange = cursors.Range.fromNode(root);
+ var regionRange = cursors.Range.fromNode(region);
+ var staticTextRange = cursors.Range.fromNode(staticText);
+ var inlineTextBoxRange = cursors.Range.fromNode(inlineTextBox);
+
+ // Positive cases.
+ assertTrue(regionRange.contentEquals(staticTextRange));
+ assertTrue(staticTextRange.contentEquals(regionRange));
+ assertTrue(inlineTextBoxRange.contentEquals(staticTextRange));
+ assertTrue(staticTextRange.contentEquals(inlineTextBoxRange));
+
+ // Negative cases.
+ assertFalse(rootRange.contentEquals(regionRange));
+ assertFalse(rootRange.contentEquals(staticTextRange));
+ assertFalse(rootRange.contentEquals(inlineTextBoxRange));
+ assertFalse(regionRange.contentEquals(rootRange));
+ assertFalse(staticTextRange.contentEquals(rootRange));
+ assertFalse(inlineTextBoxRange.contentEquals(rootRange));
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698