Add file status tooltip and add declare modified status
The single-letter file status indicators provided explanations only in their ARIA labels, making it difficult to learn what the letter signifies. Add a native tooltip to match the ARIA label value. Fix the label generation for the most common file status ("modified") and add tests. Bug: Issue 9461 Change-Id: I5eac244a3c4f8895386b5dc95788f92dd3297df2
This commit is contained in:
parent
b0e82956b1
commit
ca0d124b2d
@ -287,6 +287,7 @@ limitations under the License.
|
||||
data-path$="[[file.__path]]" tabindex="-1">
|
||||
<div class$="[[_computeClass('status', file.__path)]]"
|
||||
tabindex="0"
|
||||
title$="[[_computeFileStatusLabel(file.status)]]"
|
||||
aria-label$="[[_computeFileStatusLabel(file.status)]]">
|
||||
[[_computeFileStatus(file.status)]]
|
||||
</div>
|
||||
|
@ -35,6 +35,7 @@
|
||||
A: 'Added',
|
||||
C: 'Copied',
|
||||
D: 'Deleted',
|
||||
M: 'Modified',
|
||||
R: 'Renamed',
|
||||
W: 'Rewritten',
|
||||
U: 'Unchanged',
|
||||
@ -895,6 +896,12 @@
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a descriptive label for use in the status indicator's tooltip and
|
||||
* ARIA label.
|
||||
* @param {string} status
|
||||
* @return {string}
|
||||
*/
|
||||
_computeFileStatusLabel(status) {
|
||||
const statusCode = this._computeFileStatus(status);
|
||||
return FileStatus.hasOwnProperty(statusCode) ?
|
||||
|
@ -797,6 +797,11 @@ limitations under the License.
|
||||
assert.isTrue(tapSpy.lastCall.args[0].defaultPrevented);
|
||||
});
|
||||
|
||||
test('_computeFileStatusLabel', () => {
|
||||
assert.equal(element._computeFileStatusLabel('A'), 'Added');
|
||||
assert.equal(element._computeFileStatusLabel('M'), 'Modified');
|
||||
});
|
||||
|
||||
test('_handleFileListTap', () => {
|
||||
element._filesByPath = {
|
||||
'/COMMIT_MSG': {},
|
||||
|
Loading…
Reference in New Issue
Block a user