sort options list (#16145) (#16156)

This commit is contained in:
Nathan Reese 2018-01-19 09:19:42 -07:00 committed by GitHub
parent 0d494550b1
commit 9652db16ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -65,6 +65,8 @@ export async function listControlFactory(controlParams, kbnApi, useTimeFilter) {
const resp = await searchSource.fetch();
const termsSelectOptions = _.get(resp, 'aggregations.termsAgg.buckets', []).map((bucket) => {
return { label: bucket.key.toString(), value: bucket.key.toString() };
}).sort((a, b) => {
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
});
const listControl = new ListControl(

View file

@ -35,7 +35,7 @@ export default function ({ getService, getPageObjects }) {
it('should contain dropdown with terms aggregation results as options', async () => {
const menu = await PageObjects.visualize.getReactSelectOptions('inputControl0');
expect(menu.trim().split('\n').join()).to.equal('win 8,win xp,win 7,ios,osx');
expect(menu.trim().split('\n').join()).to.equal('ios,osx,win 7,win 8,win xp');
});
it('should display staging control buttons', async () => {
@ -160,7 +160,7 @@ export default function ({ getService, getPageObjects }) {
// Expect control to have values for selected time filter
const menu = await PageObjects.visualize.getReactSelectOptions('inputControl0');
expect(menu.trim().split('\n').join()).to.equal('win 8,win xp,win 7,osx');
expect(menu.trim().split('\n').join()).to.equal('osx,win 7,win 8,win xp');
});
});
});