Chromium Code Reviews| 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 89eecd812ea08a97def1afae7b16eef5579f9b02..eca89c19e2672207c707ae454309f6a76b723838 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs |
| @@ -83,3 +83,101 @@ TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { |
| ]}, 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()); |
| + }); |
| +}); |
| + |
| +TEST_F('OutputE2ETest', 'Headings', function() { |
| + this.runWithLoadedTree( |
| + '<h1>a</h1><h2>b</h2><h3>c</h3><h4>d</h4><h5>e</h5><h6>f</h6>', |
| + function(root) { |
| + var el = root.firstChild; |
| + var range = cursors.Range.fromNode(el); |
| + var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 1a', 'spans_': [ |
|
dmazzoni
2015/04/15 21:06:06
I'd be happier if toSpannable didn't run things to
|
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + |
| + el = el.nextSibling; |
| + range = cursors.Range.fromNode(el); |
| + o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 2b', 'spans_': [ |
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + |
| + el = el.nextSibling; |
| + range = cursors.Range.fromNode(el); |
| + o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 3c', 'spans_': [ |
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + |
| + el = el.nextSibling; |
| + range = cursors.Range.fromNode(el); |
| + o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 4d', 'spans_': [ |
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + |
| + el = el.nextSibling; |
| + range = cursors.Range.fromNode(el); |
| + o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 5e', 'spans_': [ |
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + |
| + el = el.nextSibling; |
| + range = cursors.Range.fromNode(el); |
| + o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| + assertEqualsJSON({string_: 'Heading 6f', 'spans_': [ |
| + // Attributes. |
| + {value: 'name', start: 9, end: 10} |
| + ]}, o.toSpannable()); |
| + }); |
| +}); |