mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
fix optioned text, add regex test
This commit is contained in:
parent
97158ce9f9
commit
53d58303ef
1 changed files with 17 additions and 5 deletions
|
@ -6,6 +6,7 @@ define(function (require) {
|
|||
var BaseAggParam;
|
||||
var FieldAggParam;
|
||||
var OptionedAggParam;
|
||||
var RegexAggParam;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
// stub out the param classes before we get the AggParams
|
||||
|
@ -16,6 +17,7 @@ define(function (require) {
|
|||
BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
FieldAggParam = Private(require('components/agg_types/param_types/field'));
|
||||
OptionedAggParam = Private(require('components/agg_types/param_types/optioned'));
|
||||
RegexAggParam = Private(require('components/agg_types/param_types/regex'));
|
||||
}));
|
||||
|
||||
describe('constructor args', function () {
|
||||
|
@ -53,14 +55,11 @@ define(function (require) {
|
|||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Uses the OptionedAggParam class for params with defined options', function () {
|
||||
it('Uses the OptionedAggParam class for params of type "optioned"', function () {
|
||||
var aggParams = new AggParams([
|
||||
{
|
||||
name: 'interval',
|
||||
options: [
|
||||
{ display: 'Automatic', val: 'auto' },
|
||||
{ display: '2 Hours', val: '2h' }
|
||||
]
|
||||
type: 'optioned'
|
||||
}
|
||||
]);
|
||||
|
||||
|
@ -69,6 +68,19 @@ define(function (require) {
|
|||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Uses the RegexAggParam class for params of type "regex"', function () {
|
||||
var aggParams = new AggParams([
|
||||
{
|
||||
name: 'exclude',
|
||||
type: 'regex'
|
||||
}
|
||||
]);
|
||||
|
||||
expect(aggParams).to.have.length(1);
|
||||
expect(aggParams[0]).to.be.a(RegexAggParam);
|
||||
expect(aggParams[0]).to.be.a(BaseAggParam);
|
||||
});
|
||||
|
||||
it('Always converts the params to a BaseAggParam', function () {
|
||||
var aggParams = new AggParams([
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue