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

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

Issue 1094463003: Reland: Split spoken feedback up on a per format rule basis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 years, 8 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/output_test.extjs
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs
index 443885c3735b110630a06d6d976960221ab7ff55..89eecd812ea08a97def1afae7b16eef5579f9b02 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs
@@ -23,17 +23,63 @@ OutputE2ETest.prototype = {
}
};
-TEST_F('OutputE2ETest', 'RenderBasic', function() {
+TEST_F('OutputE2ETest', 'Links', function() {
this.runWithLoadedTree('<a href="#">Click here</a>',
function(root) {
- var link = root.firstChild.firstChild;
- var range = cursors.Range.fromNode(link);
+ var el = root.firstChild.firstChild;
+ var range = cursors.Range.fromNode(el);
var o = new Output().withSpeechAndBraille(range, null, 'navigate');
- assertEqualsJSON({string_: 'Click here Link', 'spans_': [
- {value: 'name', start: 0, end: 10},
- // Link earcon.
- {value: {}, start: 11, end: 15}
- ]},
- o.getBuffer());
+ assertEqualsJSON({string_: 'Click hereLink', 'spans_': [
+ // Attributes.
+ {value: 'name', start: 0, end: 10},
+ {value: 'role', start: 10, end: 14},
+
+ // Link earcon (based on the role).
+ {value: {}, start: 10, end: 14}
+ ]}, o.toSpannable());
+ });
+});
+
+TEST_F('OutputE2ETest', 'Checkbox', function() {
+ this.runWithLoadedTree('<input type="checkbox">',
+ function(root) {
+ var el = root.firstChild.firstChild;
+ var range = cursors.Range.fromNode(el);
+ var o = new Output().withSpeechAndBraille(range, null, 'navigate');
+ assertEqualsJSON({string_: 'Check boxnot checked', 'spans_': [
+ // Attributes.
+ {value: 'name', start: 0, end: 0},
+ {value: 'role', start: 0, end: 9},
+ {value: 'state', start: 9, end: 20},
+
+ // Link earcon (based on the state).
+ {value: {}, start: 9, end: 20}
+ ]}, o.toSpannable());
+ });
+});
+
+TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() {
+ this.runWithLoadedTree('<p>OK',
+ function(root) {
+ var el = root.firstChild.firstChild.firstChild;
+ assertEquals('inlineTextBox', el.role);
+ var range = cursors.Range.fromNode(el);
+ var o = new Output().withSpeechAndBraille(range, null, 'navigate');
+ assertEqualsJSON({string_: 'OK', 'spans_': [
+ // Attributes.
+ {value: 'name', start: 0, end: 2}
+ ]}, o.toSpannable());
+
+ el = root.firstChild.firstChild;
+ assertEquals('staticText', el.role);
+ range = cursors.Range.fromNode(el);
+ o = new Output().withSpeechAndBraille(range, null, 'navigate');
+ assertEqualsJSON({string_: 'OK', 'spans_': [
+ // Attributes.
+ {value: 'value', start: 0, end: 2},
+
+ // The name is an empty string.
+ {value: 'name', start: 2, end: 2}
+ ]}, o.toSpannable());
});
});

Powered by Google App Engine
This is Rietveld 408576698