diff --git a/polygerrit-ui/app/elements/gr-diff-view.html b/polygerrit-ui/app/elements/gr-diff-view.html
index 9d15045818..761dd7158d 100644
--- a/polygerrit-ui/app/elements/gr-diff-view.html
+++ b/polygerrit-ui/app/elements/gr-diff-view.html
@@ -132,7 +132,7 @@ limitations under the License.
hidden$="[[!_loggedIn]]" hidden>
+
+[[file.lines_inserted]]
-[[file.lines_deleted]]
@@ -154,6 +159,8 @@ limitations under the License.
(function() {
'use strict';
+ var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
+
Polymer({
is: 'gr-file-list',
@@ -311,10 +318,26 @@ limitations under the License.
return index == selectedIndex;
},
+ _computeFileStatus: function(status) {
+ return status || 'M';
+ },
+
_computeDiffURL: function(changeNum, patchNum, path) {
return '/c/' + changeNum + '/' + patchNum + '/' + path;
},
+ _computeFileDisplayName: function(path) {
+ return path == COMMIT_MESSAGE_PATH ? 'Commit message' : path;
+ },
+
+ _computeClass: function(baseClass, path) {
+ var classes = [baseClass];
+ if (path == COMMIT_MESSAGE_PATH) {
+ classes.push('invisible');
+ }
+ return classes.join(' ');
+ },
+
_send: function(method, url) {
var xhr = document.createElement('gr-request');
this._xhrPromise = xhr.send({
diff --git a/polygerrit-ui/app/test/gr-diff-view-test.html b/polygerrit-ui/app/test/gr-diff-view-test.html
index aec35c2791..da3626cddf 100644
--- a/polygerrit-ui/app/test/gr-diff-view-test.html
+++ b/polygerrit-ui/app/test/gr-diff-view-test.html
@@ -321,6 +321,11 @@ limitations under the License.
assert.equal(linkEls[0].getAttribute('href'), '/c/42/10/chell.go');
assert.equal(linkEls[1].getAttribute('href'), '/c/42/10/glados.txt');
assert.equal(linkEls[2].getAttribute('href'), '/c/42/10/wheatley.md');
+
+ assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
+ '/foo/bar/baz');
+ assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
+ 'Commit message');
});
test('jump to file dropdown with patch range', function() {
diff --git a/polygerrit-ui/app/test/gr-file-list-test.html b/polygerrit-ui/app/test/gr-file-list-test.html
index e0b6458bfd..aabca509c3 100644
--- a/polygerrit-ui/app/test/gr-file-list-test.html
+++ b/polygerrit-ui/app/test/gr-file-list-test.html
@@ -260,6 +260,21 @@ limitations under the License.
'');
});
+ test('computed properties', function() {
+ assert.equal(element._computeFileStatus('A'), 'A');
+ assert.equal(element._computeFileStatus(undefined), 'M');
+ assert.equal(element._computeFileStatus(null), 'M');
+
+ assert.equal(element._computeFileDisplayName('/foo/bar/baz'),
+ '/foo/bar/baz');
+ assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
+ 'Commit message');
+
+ assert.equal(element._computeClass('clazz', '/foo/bar/baz'), 'clazz');
+ assert.equal(element._computeClass('clazz', '/COMMIT_MSG'),
+ 'clazz invisible');
+ });
+
test('file review status', function(done) {
element.changeNum = '42';
element.patchNum = '2';