-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue/6556
- Loading branch information
Showing
13 changed files
with
90 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import ngMock from 'ng_mock'; | ||
import expect from 'expect.js'; | ||
|
||
import MockState from 'fixtures/mock_state'; | ||
import notify from 'ui/notify'; | ||
import AggConfigResult from 'ui/vis/agg_config_result'; | ||
|
||
import VisProvider from 'ui/vis'; | ||
import StubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; | ||
import FilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; | ||
|
||
describe('filterBarClickHandler', function () { | ||
let setup = null; | ||
|
||
beforeEach(ngMock.module('kibana')); | ||
beforeEach(ngMock.inject(function (Private) { | ||
setup = function () { | ||
const Vis = Private(VisProvider); | ||
const createClickHandler = Private(FilterBarClickHandlerProvider); | ||
const indexPattern = Private(StubbedLogstashIndexPatternProvider); | ||
|
||
const vis = new Vis(indexPattern, { | ||
type: 'histogram', | ||
aggs: [ | ||
{ type: 'count', schema: 'metric' }, | ||
{ | ||
type: 'terms', | ||
schema: 'segment', | ||
params: { field: '_type' } | ||
} | ||
] | ||
}); | ||
const aggConfigResult = new AggConfigResult(vis.aggs[1], void 0, 'apache', 'apache'); | ||
|
||
const $state = new MockState({ filters: [] }); | ||
const clickHandler = createClickHandler($state); | ||
|
||
return { clickHandler, $state, aggConfigResult }; | ||
}; | ||
})); | ||
|
||
afterEach(function () { | ||
notify._notifs.splice(0); | ||
}); | ||
|
||
context('on non-filterable fields', function () { | ||
it('warns about trying to filter on a non-filterable field', function () { | ||
const { clickHandler, aggConfigResult } = setup(); | ||
expect(notify._notifs).to.have.length(0); | ||
clickHandler({ point: { aggConfigResult }}); | ||
expect(notify._notifs).to.have.length(1); | ||
}); | ||
|
||
it('does not warn if the event is click is being simulated', function () { | ||
const { clickHandler, aggConfigResult } = setup(); | ||
expect(notify._notifs).to.have.length(0); | ||
clickHandler({ point: { aggConfigResult }}, true); | ||
expect(notify._notifs).to.have.length(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters