Merge "Add file status tooltip and add declare modified status"

This commit is contained in:
Wyatt Allen 2018-09-14 18:29:32 +00:00 committed by Gerrit Code Review
commit d3a779a8b4
3 changed files with 13 additions and 0 deletions

View File

@ -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>

View File

@ -35,6 +35,7 @@
A: 'Added',
C: 'Copied',
D: 'Deleted',
M: 'Modified',
R: 'Renamed',
W: 'Rewritten',
U: 'Unchanged',
@ -894,6 +895,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) ?

View File

@ -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': {},