Display message when no changes are available

Message is kept unspecific since it can be shown because of search
query with no matches or dashboard group with no items.

Change-Id: I02020aa51651e6a2c1c8a72908ce2fc5bd77bd73
This commit is contained in:
Urs Wolfer
2016-02-26 20:03:27 +01:00
parent d8a953f2a4
commit 68223dccea
3 changed files with 27 additions and 0 deletions

View File

@@ -49,6 +49,9 @@ limitations under the License.
<template is="dom-if" if="[[_groupTitle(groupIndex)]]">
<div class="groupHeader">[[_groupTitle(groupIndex)]]</div>
</template>
<template is="dom-if" if="[[!changeGroup.length]]">
<div class="noChanges">No changes</div>
</template>
<template is="dom-repeat" items="[[changeGroup]]" as="change">
<gr-change-list-item
selected$="[[_computeItemSelected(index, groupIndex, selectedIndex)]]"

View File

@@ -29,6 +29,10 @@ limitations under the License.
background-color: #ddd;
flex-shrink: 0;
}
.noChanges {
border-bottom: 1px solid #eee;
padding: .3em .5em;
}
.keyboard,
.star {
align-items: center;

View File

@@ -136,6 +136,26 @@ limitations under the License.
assert.isFalse(elementItems[2].hasAttribute('unreviewed'));
});
test('no changes', function() {
element.changes = [];
flushAsynchronousOperations();
var listItems = Polymer.dom(element.root).querySelectorAll(
'gr-change-list-item');
assert.equal(listItems.length, 0);
var noChangesMsg = Polymer.dom(element.root).querySelector('.noChanges');
assert.ok(noChangesMsg);
});
test('empty groups', function() {
element.groups = [[], []];
flushAsynchronousOperations();
var listItems = Polymer.dom(element.root).querySelectorAll(
'gr-change-list-item');
assert.equal(listItems.length, 0);
var noChangesMsg = Polymer.dom(element.root).querySelectorAll(
'.noChanges');
assert.equal(noChangesMsg.length, 2);
});
});
suite('gr-change-list groups', function() {