forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning text doesn't get displayed on filters with custom filter …
…name (elastic#78617) (elastic#78929) Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
2afee59
commit c710567
Showing
6 changed files
with
177 additions
and
71 deletions.
There are no files selected for viewing
18 changes: 0 additions & 18 deletions
18
...ugins/data/public/ui/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.js.snap
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.js
This file was deleted.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.tsx
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,156 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FilterLabel } from './filter_label'; | ||
import { render, cleanup } from '@testing-library/react/pure'; | ||
import { phraseFilter } from '../../../../stubs'; | ||
|
||
afterEach(cleanup); | ||
|
||
test('alias', () => { | ||
const filter = { | ||
...phraseFilter, | ||
meta: { | ||
...phraseFilter.meta, | ||
alias: 'geo.coordinates in US', | ||
}, | ||
}; | ||
const { container } = render(<FilterLabel filter={filter} />); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
geo.coordinates in US | ||
</div> | ||
`); | ||
}); | ||
|
||
test('negated alias', () => { | ||
const filter = { | ||
...phraseFilter, | ||
meta: { | ||
...phraseFilter.meta, | ||
alias: 'geo.coordinates in US', | ||
negate: true, | ||
}, | ||
}; | ||
const { container } = render(<FilterLabel filter={filter} />); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
<span | ||
class="euiTextColor euiTextColor--danger" | ||
> | ||
NOT | ||
</span> | ||
geo.coordinates in US | ||
</div> | ||
`); | ||
}); | ||
|
||
test('alias with warning status', () => { | ||
const filter = { | ||
...phraseFilter, | ||
meta: { | ||
...phraseFilter.meta, | ||
alias: 'geo.coordinates in US', | ||
negate: true, | ||
}, | ||
}; | ||
const { container } = render( | ||
<FilterLabel filter={filter} valueLabel={'Warning'} filterLabelStatus={'warn'} /> | ||
); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
<span | ||
class="euiTextColor euiTextColor--danger" | ||
> | ||
NOT | ||
</span> | ||
geo.coordinates in US | ||
: | ||
<span | ||
class="globalFilterLabel__value" | ||
> | ||
Warning | ||
</span> | ||
</div> | ||
`); | ||
}); | ||
|
||
test('alias with error status', () => { | ||
const filter = { | ||
...phraseFilter, | ||
meta: { | ||
...phraseFilter.meta, | ||
alias: 'geo.coordinates in US', | ||
negate: true, | ||
}, | ||
}; | ||
const { container } = render( | ||
<FilterLabel filter={filter} valueLabel={'Error'} filterLabelStatus={'error'} /> | ||
); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
<span | ||
class="euiTextColor euiTextColor--danger" | ||
> | ||
NOT | ||
</span> | ||
geo.coordinates in US | ||
: | ||
<span | ||
class="globalFilterLabel__value" | ||
> | ||
Error | ||
</span> | ||
</div> | ||
`); | ||
}); | ||
|
||
test('warning', () => { | ||
const { container } = render(<FilterLabel filter={phraseFilter} valueLabel={'Warning'} />); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
machine.os | ||
: | ||
<span | ||
class="globalFilterLabel__value" | ||
> | ||
Warning | ||
</span> | ||
</div> | ||
`); | ||
}); | ||
|
||
test('error', () => { | ||
const { container } = render(<FilterLabel filter={phraseFilter} valueLabel={'Error'} />); | ||
expect(container).toMatchInlineSnapshot(` | ||
<div> | ||
machine.os | ||
: | ||
<span | ||
class="globalFilterLabel__value" | ||
> | ||
Error | ||
</span> | ||
</div> | ||
`); | ||
}); |
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