Commit 89cd4f1e authored by David Tseng's avatar David Tseng Committed by Commit Bot

Reorder and fine-tune range output (e.g. sliders)


Trim whitespace for input type="tel" This fixes custom text fields of type="tel" that insert whitespace as padding.

Bug: 854891
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I44e152c9b7246fd5b2da701b218cf4a89a979139
Reviewed-on: https://chromium-review.googlesource.com/1112301
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarKatie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569861}
parent 1a52d95d
...@@ -370,10 +370,11 @@ Output.RULES = { ...@@ -370,10 +370,11 @@ Output.RULES = {
$description $restriction` $description $restriction`
}, },
abstractRange: { abstractRange: {
speak: `$if($valueForRange, $valueForRange, $value) speak: `$name $node(activeDescendant) $description $role
$if($value, $value, $if($valueForRange, $valueForRange))
$state $restriction
$if($minValueForRange, @aria_value_min($minValueForRange)) $if($minValueForRange, @aria_value_min($minValueForRange))
$if($maxValueForRange, @aria_value_max($maxValueForRange)) $if($maxValueForRange, @aria_value_max($maxValueForRange))`
$name $node(activeDescendant) $role $description $state $restriction`
}, },
alert: { alert: {
enter: `$name $role $state`, enter: `$name $role $state`,
...@@ -716,6 +717,8 @@ Output.isTruthy = function(node, attrib) { ...@@ -716,6 +717,8 @@ Output.isTruthy = function(node, attrib) {
// These attributes default to false for empty strings. // These attributes default to false for empty strings.
case 'roleDescription': case 'roleDescription':
return !!node.roleDescription; return !!node.roleDescription;
case 'value':
return !!node.value;
case 'selected': case 'selected':
return node.selected === true; return node.selected === true;
default: default:
......
...@@ -251,18 +251,19 @@ TEST_F('OutputE2ETest', 'Audio', function() { ...@@ -251,18 +251,19 @@ TEST_F('OutputE2ETest', 'Audio', function() {
var o = new Output() var o = new Output()
.withoutHints() .withoutHints()
.withSpeechAndBraille(range, prevRange, 'navigate'); .withSpeechAndBraille(range, prevRange, 'navigate');
checkSpeechOutput('0|Min 0|Max 0||Slider|audio time scrubber', checkSpeechOutput('|audio time scrubber|Slider|0:00|Min 0|Max 0',
[ [
{value: 'valueForRange', start: 0, end: 1}, {value: 'name', start: 0, end: 0},
{value: 'name', start: 14, end: 14}, {value: new Output.EarconAction('SLIDER'), start: 0, end: 0},
{value: new Output.EarconAction('SLIDER'), start: 14, end: 14}, {value: 'description', start: 1, end: 20},
{value: 'role', start: 15, end: 21}, {value: 'role', start: 21, end: 27},
{value: 'description', start: 22, end: 41} {value: 'value', start: 28, end: 32}
], ],
o); o);
checkBrailleOutput( checkBrailleOutput(
'0 min:0 max:0 sldr audio time scrubber', 'audio time scrubber sldr 0:00 min:0 max:0',
[{value: new Output.NodeSpan(el), start: 0, end: 38}], [
{value: new Output.NodeSpan(el), start: 0, end: 41}],
o); o);
}); });
}); });
...@@ -293,12 +294,12 @@ TEST_F('OutputE2ETest', 'Input', function() { ...@@ -293,12 +294,12 @@ TEST_F('OutputE2ETest', 'Input', function() {
'||Edit text, email entry', '||Edit text, email entry',
'||Password edit text', '||Password edit text',
'||Edit text numeric only', '||Edit text numeric only',
['||Spin button', ['|Spin button',
[{value: new Output.SelectionSpan(0, 0), start: 0, end: 0}, [
{value: 'value', start: 0, end: 0}, {value: 'name', start: 0, end: 0},
{value: 'name', start: 1, end: 1}, {value: new Output.EarconAction('LISTBOX'), start: 0, end: 0},
{value: new Output.EarconAction('LISTBOX'), start: 1, end: 1}, {value: 'role', start: 1, end: 12}
{value: 'role', start: 2, end: 13}] ]
], ],
['Time control', ['Time control',
[{value: 'role', start: 0, end: 12}] [{value: 'role', start: 0, end: 12}]
...@@ -322,7 +323,7 @@ TEST_F('OutputE2ETest', 'Input', function() { ...@@ -322,7 +323,7 @@ TEST_F('OutputE2ETest', 'Input', function() {
' @ed 8dot', ' @ed 8dot',
' pwded', ' pwded',
' #ed', ' #ed',
' spnbtn', {string_: 'spnbtn', spans_: []},
{string_: 'time'}, {string_: 'time'},
{string_: 'date'}, {string_: 'date'},
{string_: 'Choose File No file chosen btn'}, {string_: 'Choose File No file chosen btn'},
...@@ -361,11 +362,12 @@ TEST_F('OutputE2ETest', 'Input', function() { ...@@ -361,11 +362,12 @@ TEST_F('OutputE2ETest', 'Input', function() {
end: expectedValue.length}], end: expectedValue.length}],
o); o);
} else { } else {
checkBrailleOutput( var spans = [{value: new Output.NodeSpan(el), start: 0,
expectedValue.string_, end: expectedValue.string_.length}];
[{value: new Output.NodeSpan(el), start: 0, if (expectedValue.spans_)
end: expectedValue.string_.length}], spans = spans.concat(expectedValue.spans_);
o);
checkBrailleOutput(expectedValue.string_, spans, o);
} }
el = el.nextSibling; el = el.nextSibling;
}); });
...@@ -800,12 +802,12 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() { ...@@ -800,12 +802,12 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() {
var o = new Output() var o = new Output()
.withoutHints() .withoutHints()
.withSpeech(cursors.Range.fromNode(obj)); .withSpeech(cursors.Range.fromNode(obj));
checkSpeechOutput('2|Min 1|Max 10|volume|Slider', checkSpeechOutput('volume|Slider|2|Min 1|Max 10',
[ [
{value: 'valueForRange', start: 0, end: 1}, {value: 'name', start: 0, end: 6},
{value: 'name', start: 15,end: 21}, {value: new Output.EarconAction('SLIDER'), start: 0, end: 6},
{value: new Output.EarconAction('SLIDER'), start: 15, end: 21}, {value: 'role', start: 7, end: 13},
{value: 'role', start: 22, end: 28} {value: 'valueForRange', start: 14, end: 15}
], ],
o); o);
...@@ -813,11 +815,11 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() { ...@@ -813,11 +815,11 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() {
o = new Output() o = new Output()
.withoutHints() .withoutHints()
.withSpeech(cursors.Range.fromNode(obj)); .withSpeech(cursors.Range.fromNode(obj));
checkSpeechOutput('2|Min 1|Max 10|volume|Progress indicator', checkSpeechOutput('volume|Progress indicator|2|Min 1|Max 10',
[ [
{value: 'valueForRange', start: 0, end: 1}, {value: 'name', start: 0,end: 6},
{value: 'name', start: 15,end: 21}, {value: 'role', start: 7, end: 25},
{value: 'role', start: 22, end: 40} {value: 'valueForRange', start: 26, end: 27}
], ],
o); o);
...@@ -825,11 +827,11 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() { ...@@ -825,11 +827,11 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() {
o = new Output() o = new Output()
.withoutHints() .withoutHints()
.withSpeech(cursors.Range.fromNode(obj)); .withSpeech(cursors.Range.fromNode(obj));
checkSpeechOutput('2|Min 1|Max 10|volume|Meter', checkSpeechOutput('volume|Meter|2|Min 1|Max 10',
[ [
{value: 'valueForRange', start: 0, end: 1}, {value: 'name', start: 0,end: 6},
{value: 'name', start: 15,end: 21}, {value: 'role', start: 7, end: 12},
{value: 'role', start: 22, end: 27} {value: 'valueForRange', start: 13, end: 14}
], ],
o); o);
...@@ -837,12 +839,12 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() { ...@@ -837,12 +839,12 @@ TEST_F('OutputE2ETest', 'RangeOutput', function() {
o = new Output() o = new Output()
.withoutHints() .withoutHints()
.withSpeech(cursors.Range.fromNode(obj)); .withSpeech(cursors.Range.fromNode(obj));
checkSpeechOutput('2|Min 1|Max 10|volume|Spin button', checkSpeechOutput('volume|Spin button|2|Min 1|Max 10',
[ [
{value: 'valueForRange', start: 0, end: 1}, {value: 'name', start: 0,end: 6},
{value: 'name', start: 15,end: 21}, {value: new Output.EarconAction('LISTBOX'), start: 0, end: 6},
{value: new Output.EarconAction('LISTBOX'), start: 15, end: 21}, {value: 'role', start: 7, end: 18},
{value: 'role', start: 22, end: 33} {value: 'valueForRange', start: 19, end: 20}
], ],
o); o);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment