Merge "Fix binding for visible file number"
This commit is contained in:
commit
5367f14a9e
polygerrit-ui/app/elements/diff/gr-diff-view
@ -124,10 +124,12 @@ limitations under the License.
|
||||
.editMode .hideOnEdit {
|
||||
display: none;
|
||||
}
|
||||
.blameLoader {
|
||||
.blameLoader,
|
||||
.fileNum {
|
||||
display: none;
|
||||
}
|
||||
.blameLoader.show,
|
||||
.fileNum.show ,
|
||||
.download,
|
||||
.preferences,
|
||||
.rightControls {
|
||||
@ -230,7 +232,7 @@ limitations under the License.
|
||||
</div>
|
||||
</h3>
|
||||
<div class="navLinks desktop">
|
||||
<span class$="fileNum [[_computeFileNumVisible(_fileNum, _formattedFiles)]]">
|
||||
<span class$="fileNum [[_computeFileNumClass(_fileNum, _formattedFiles)]]">
|
||||
File [[_fileNum]] of [[_formattedFiles.length]]
|
||||
<span class="separator"></span>
|
||||
</span>
|
||||
|
@ -959,14 +959,16 @@
|
||||
return files.findIndex(({value}) => value === file) + 1;
|
||||
},
|
||||
|
||||
_computeFileNumVisible(file, files) {
|
||||
if (!files) { return 'hidden'; }
|
||||
const fileNum = this._computeFileNum(file, files);
|
||||
if (!isNaN(fileNum) && isFinite(fileNum) && fileNum > 0) {
|
||||
return '';
|
||||
} else {
|
||||
return 'hidden';
|
||||
/**
|
||||
* @param {number} fileNum
|
||||
* @param {!Array<string>} files
|
||||
* @return {string}
|
||||
*/
|
||||
_computeFileNumClass(fileNum, files) {
|
||||
if (files && fileNum > 0) {
|
||||
return 'show';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
@ -988,10 +988,10 @@ limitations under the License.
|
||||
[{value: '/foo'}, {value: '/bar'}]), 2);
|
||||
});
|
||||
|
||||
test('_computeFileNumVisible', () => {
|
||||
assert.equal(element._computeFileNumVisible('', []), 'hidden');
|
||||
assert.equal(element._computeFileNumVisible('/bar',
|
||||
[{value: '/foo'}, {value: '/bar'}]), '');
|
||||
test('_computeFileNumClass', () => {
|
||||
assert.equal(element._computeFileNumClass(0, []), '');
|
||||
assert.equal(element._computeFileNumClass(1,
|
||||
[{value: '/foo'}, {value: '/bar'}]), 'show');
|
||||
});
|
||||
|
||||
suite('editMode behavior', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user