Show gray background in change-list for not applicable labels

Change-Id: Iafa00d98d09c95bfa5bd44c7b0de7e8c5569820f
This commit is contained in:
Urs Wolfer
2016-03-20 18:23:43 +01:00
parent c9733eb8f7
commit de6620f49c
3 changed files with 16 additions and 4 deletions

View File

@@ -60,6 +60,9 @@ limitations under the License.
.u-red {
color: #D32F2F;
}
.u-gray-background {
background-color: #F5F5F5;
}
</style>
<style include="gr-change-list-styles"></style>
<span class="cell keyboard">

View File

@@ -72,7 +72,7 @@
_computeLabelTitle: function(change, labelName) {
var label = change.labels[labelName];
if (!label) { return labelName; }
if (!label) { return 'Label not applicable'; }
var significantLabel = label.rejected || label.approved ||
label.disliked || label.recommended;
if (significantLabel && significantLabel.name) {
@@ -102,6 +102,8 @@
if (label.rejected) {
classes['u-red'] = true;
}
} else {
classes['u-gray-background'] = true;
}
return Object.keys(classes).sort().join(' ');
},

View File

@@ -51,9 +51,10 @@ limitations under the License.
assert.equal(element._computeChangeStatusString({status: 'DRAFT'}),
'Draft');
assert.equal(element._computeLabelClass({labels: {}}), 'cell label');
assert.equal(element._computeLabelClass({labels: {}}),
'cell label u-gray-background');
assert.equal(element._computeLabelClass(
{labels: {}}, 'Verified'), 'cell label');
{labels: {}}, 'Verified'), 'cell label u-gray-background');
assert.equal(element._computeLabelClass(
{labels: {Verified: {approved: true, value: 1}}}, 'Verified'),
'cell label u-green u-monospace');
@@ -66,12 +67,18 @@ limitations under the License.
assert.equal(element._computeLabelClass(
{labels: {'Code-Review': {value: -1}}}, 'Code-Review'),
'cell label u-monospace u-red');
assert.equal(element._computeLabelClass(
{labels: {'Code-Review': {value: -1}}}, 'Verified'),
'cell label u-gray-background');
assert.equal(element._computeLabelTitle({labels: {}}, 'Verified'),
'Verified');
'Label not applicable');
assert.equal(element._computeLabelTitle(
{labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Verified'),
'Verified\nby Diffy');
assert.equal(element._computeLabelTitle(
{labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Code-Review'),
'Label not applicable');
assert.equal(element._computeLabelTitle(
{labels: {Verified: {rejected: {name: 'Diffy'}}}}, 'Verified'),
'Verified\nby Diffy');