Commit 9ba360de authored by dtseng's avatar dtseng Committed by Commit bot

Support output of input types (email, tel, time, date).

Time and date appear as a series of spin buttons with their help attributes containing their label text. Include $help in the default output rule.
Add a condition to substitute a proper role message string for role textField.

TEST=OutputE2ETest.*

Review URL: https://codereview.chromium.org/1106583003

Cr-Commit-Position: refs/heads/master@{#326885}
parent fcdaba12
...@@ -93,6 +93,9 @@ Output.ROLE_INFO_ = { ...@@ -93,6 +93,9 @@ Output.ROLE_INFO_ = {
checkBox: { checkBox: {
msgId: 'input_type_checkbox' msgId: 'input_type_checkbox'
}, },
date: {
msgId: 'input_type_date'
},
dialog: { dialog: {
msgId: 'dialog' msgId: 'dialog'
}, },
...@@ -116,6 +119,10 @@ Output.ROLE_INFO_ = { ...@@ -116,6 +119,10 @@ Output.ROLE_INFO_ = {
radioButton: { radioButton: {
msgId: 'input_type_radio' msgId: 'input_type_radio'
}, },
spinButton: {
msgId: 'aria_role_combobox',
earcon: 'LISTBOX'
},
textBox: { textBox: {
msgId: 'input_type_text', msgId: 'input_type_text',
earcon: 'EDITABLE_TEXT' earcon: 'EDITABLE_TEXT'
...@@ -124,6 +131,9 @@ Output.ROLE_INFO_ = { ...@@ -124,6 +131,9 @@ Output.ROLE_INFO_ = {
msgId: 'input_type_text', msgId: 'input_type_text',
earcon: 'EDITABLE_TEXT' earcon: 'EDITABLE_TEXT'
}, },
time: {
msgId: 'tag_time'
},
toolbar: { toolbar: {
msgId: 'aria_role_toolbar' msgId: 'aria_role_toolbar'
} }
...@@ -156,7 +166,7 @@ Output.STATE_INFO_ = { ...@@ -156,7 +166,7 @@ Output.STATE_INFO_ = {
Output.RULES = { Output.RULES = {
navigate: { navigate: {
'default': { 'default': {
speak: '$name $value $description $role', speak: '$name $value $description $help $role',
braille: '' braille: ''
}, },
alert: { alert: {
...@@ -165,6 +175,10 @@ Output.RULES = { ...@@ -165,6 +175,10 @@ Output.RULES = {
checkBox: { checkBox: {
speak: '$name $role $checked' speak: '$name $role $checked'
}, },
date: {
enter: '$name $role',
leave: '@exited_container($role)'
},
dialog: { dialog: {
enter: '$name $role' enter: '$name $role'
}, },
...@@ -215,6 +229,16 @@ Output.RULES = { ...@@ -215,6 +229,16 @@ Output.RULES = {
tab: { tab: {
speak: '@describe_tab($name)' speak: '@describe_tab($name)'
}, },
textField: {
speak: '$name $value $if(' +
'$textInputType, @input_type_+$textInputType, @input_type_text) ' +
'$earcon(EDITABLE_TEXT)',
braille: ''
},
time: {
enter: '$name $role',
leave: '@exited_container($role)'
},
toolbar: { toolbar: {
enter: '$name $role' enter: '$name $role'
}, },
......
...@@ -144,18 +144,20 @@ TEST_F('OutputE2ETest', 'Audio', function() { ...@@ -144,18 +144,20 @@ TEST_F('OutputE2ETest', 'Audio', function() {
var el = root.firstChild.firstChild.firstChild.firstChild; var el = root.firstChild.firstChild.firstChild.firstChild;
var range = cursors.Range.fromNode(el); var range = cursors.Range.fromNode(el);
var o = new Output().withSpeechAndBraille(range, null, 'navigate'); var o = new Output().withSpeechAndBraille(range, null, 'navigate');
assertEqualsJSON({string_: 'media control|Tool bar|||play|Button', assertEqualsJSON(
spans_: {string_: 'media control|Tool bar|||play|begin playback|Button',
spans_:
// Entered container toolbar. // Entered container toolbar.
// Button. // Button.
[{value: 'name', start: 23, end: 23}, [{value: 'name', start: 23, end: 23},
{value: 'value', start: 24, end: 24}, {value: 'value', start: 24, end: 24},
{value: 'description', start: 25, end: 29}, {value: 'description', start: 25, end: 29},
{value: 'role', start: 30, end: 36}, {value: 'help', start: 30, end: 44},
{value: 'role', start: 45, end: 51},
// Button earcon. // Button earcon.
{value: {}, start: 30, end: 36}] {value: {}, start: 45, end: 51}]
}, o.toSpannableForTest()); }, o.toSpannableForTest());
el = el.nextSibling; el = el.nextSibling;
...@@ -168,3 +170,58 @@ TEST_F('OutputE2ETest', 'Audio', function() { ...@@ -168,3 +170,58 @@ TEST_F('OutputE2ETest', 'Audio', function() {
}, o.toSpannableForTest()); }, o.toSpannableForTest());
}); });
}); });
TEST_F('OutputE2ETest', 'Input', function() {
this.runWithLoadedTree(
'<input type="text"></input>' +
'<input type="email"></input>' +
'<input type="password"></input>' +
'<input type="tel"></input>' +
'<input type="number"></input>' +
'<input type="time"></input>' +
'<input type="date"></input>',
function(root) {
var expected = {string_: '', 'spans_': [
{value: 'name', start: 0, end: 0},
// Selection span.
{value: {startIndex: 0, endIndex: 0}, start: 1, end: 1},
{value: 'value', start: 1, end: 1},
// Earcon
{value: {}, start: 2, end: 2}
]};
var expectedValues = [
'||Edit text',
'||Edit text, email entry',
'||Password edit text',
'||Edit text, number entry',
{string_: '||Combo box', spans_: [{value: 'name', start: 0, end: 0},
{value: {startIndex: 0, endIndex: 0}, start: 1, end: 1},
{value: 'value', start: 1, end: 1},
{value: 'role', start: 2, end: 11},
{value: {}, start: 2, end: 11}]},
{string_: '||Time', spans_: [{value: 'name', start: 0, end: 0},
{value: 'value', start: 1, end: 1},
{value: 'role', start: 2, end: 6}]},
{string_: '||Date control', spans_: [{value: 'name', start: 0, end: 0},
{value: 'value', start: 1, end: 1},
{value: 'role', start: 2, end: 14}]}
];
var el = root.firstChild.firstChild;
expectedValues.forEach(function(expectedValue) {
var range = cursors.Range.fromNode(el);
var o = new Output().withSpeechAndBraille(range, null, 'navigate');
if (typeof expectedValue == 'object') {
assertEqualsJSON(expectedValue, o.toSpannableForTest());
} else {
expected.string_ = expectedValue;
assertEqualsJSON(expected, o.toSpannableForTest());
}
el = el.nextSibling;
});
});
});
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