Fix total alignment in file list

When the 'expand_inline_diffs' is set, the arrows to the right of the
files in the file list are hidden. The Total numbers were lined up based
on the assumption that the arrows were there. This change determines
padding based on user preference.

Bug: Issue 5516
Change-Id: I5c178402823a064bddb3c24dedaf4917fe05afed
This commit is contained in:
Becky Siegel 2017-02-15 16:24:03 -08:00
parent 2f341a9d37
commit 07b793599b
3 changed files with 13 additions and 2 deletions
polygerrit-ui/app/elements/change/gr-file-list

@ -124,6 +124,9 @@ limitations under the License.
padding-right: 2.6em;
text-align: right;
}
.expandInline {
padding-right: .25em;
}
.warning {
color: #666;
}
@ -318,7 +321,7 @@ limitations under the License.
project-config="[[projectConfig]]"
view-mode="[[_getDiffViewMode(diffViewMode, _userPrefs)]]"></gr-diff>
</template>
<div class="row totalChanges">
<div class$="row totalChanges [[_computeExpandInlineClass(_userPrefs)]]">
<div class="total-stats" hidden$="[[_hideChangeTotals]]">
<span
class="added"
@ -334,7 +337,7 @@ limitations under the License.
</span>
</div>
</div>
<div class="row totalChanges">
<div class$="row totalChanges [[_computeExpandInlineClass(_userPrefs)]]">
<div class="total-stats" hidden$="[[_hideBinaryChangeTotals]]">
<span class="added" aria-label="Total lines added">
[[_formatBytes(_patchChange.size_delta_inserted)]]

@ -630,6 +630,10 @@
return classes.join(' ');
},
_computeExpandInlineClass: function(userPrefs) {
return userPrefs.expand_inline_diffs ? 'expandInline' : '';
},
_computePathClass: function(path, expandedFilesRecord) {
return this._isFileExpanded(path, expandedFilesRecord) ? 'path expanded' :
'path';

@ -481,6 +481,10 @@ limitations under the License.
assert.equal(element._computeClass('clazz', '/foo/bar/baz'), 'clazz');
assert.equal(element._computeClass('clazz', '/COMMIT_MSG'),
'clazz invisible');
assert.equal(element._computeExpandInlineClass(
{expand_inline_diffs: true}), 'expandInline');
assert.equal(element._computeExpandInlineClass(
{expand_inline_diffs: false}), '');
});
test('file review status', function() {