Merge "Fix searching in "included in"" into stable-3.1
This commit is contained in:
@@ -78,13 +78,15 @@ limitations under the License.
|
|||||||
on-click="_handleCloseTap">Close</gr-button>
|
on-click="_handleCloseTap">Close</gr-button>
|
||||||
</span>
|
</span>
|
||||||
<iron-input
|
<iron-input
|
||||||
placeholder="Filter"
|
id="filterInput"
|
||||||
on-bind-value-changed="_onFilterChanged">
|
placeholder="Filter"
|
||||||
|
bind-value="{{_filterText}}"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
id="filterInput"
|
is="iron-input"
|
||||||
is="iron-input"
|
placeholder="Filter"
|
||||||
placeholder="Filter"
|
bind-value="{{_filterText}}"
|
||||||
on-bind-value-changed="_onFilterChanged">
|
/>
|
||||||
</iron-input>
|
</iron-input>
|
||||||
</header>
|
</header>
|
||||||
<div class$="[[_computeLoadingClass(_loaded)]]">Loading...</div>
|
<div class$="[[_computeLoadingClass(_loaded)]]">Loading...</div>
|
||||||
|
|||||||
@@ -65,7 +65,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
_computeGroups(includedIn, filterText) {
|
_computeGroups(includedIn, filterText) {
|
||||||
if (!includedIn) { return []; }
|
if (!includedIn || filterText === undefined) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const filter = item => !filterText.length ||
|
const filter = item => !filterText.length ||
|
||||||
item.toLowerCase().indexOf(filterText.toLowerCase()) !== -1;
|
item.toLowerCase().indexOf(filterText.toLowerCase()) !== -1;
|
||||||
@@ -94,11 +96,5 @@
|
|||||||
_computeLoadingClass(loaded) {
|
_computeLoadingClass(loaded) {
|
||||||
return loaded ? 'loading loaded' : 'loading';
|
return loaded ? 'loading loaded' : 'loading';
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFilterChanged() {
|
|
||||||
this.debounce('filter-change', () => {
|
|
||||||
this._filterText = this.$.filterInput.bindValue;
|
|
||||||
}, 100);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -82,5 +82,20 @@ limitations under the License.
|
|||||||
{title: 'Tags', items: ['v2.0', 'v2.1']},
|
{title: 'Tags', items: ['v2.0', 'v2.1']},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('_computeGroups with .bindValue', done => {
|
||||||
|
element.$.filterInput.bindValue = 'stable-3.2';
|
||||||
|
const includedIn = {branches: [], tags: []};
|
||||||
|
includedIn.branches.push('master', 'stable-3.2');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const filterText = element._filterText;
|
||||||
|
assert.deepEqual(element._computeGroups(includedIn, filterText), [
|
||||||
|
{title: 'Branches', items: ['stable-3.2']},
|
||||||
|
]);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user