[Tagcloud] Allow to send showLabel parameter with false value (#36563) (#37054)

* Allow to send showLabel parameter with false value

* Add unit test
This commit is contained in:
Maryia Lapata 2019-05-24 12:07:58 +03:00 committed by GitHub
parent 5ca9caf486
commit c03d1bbbae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -26,6 +26,8 @@ exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunct
exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles table function without splits or buckets 1`] = `"kibana_table visConfig='{\\"foo\\":\\"bar\\",\\"dimensions\\":{\\"metrics\\":[0,1],\\"buckets\\":[]}}' "`;
exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tagcloud function with boolean param showLabel 1`] = `"tagcloud metric={visdimension 0} showLabel=false "`;
exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tagcloud function with buckets 1`] = `"tagcloud metric={visdimension 0} bucket={visdimension 1 } "`;
exports[`visualize loader pipeline helpers: build pipeline buildPipelineVisFunction handles tagcloud function without buckets 1`] = `"tagcloud metric={visdimension 0} "`;

View file

@ -183,6 +183,14 @@ describe('visualize loader pipeline helpers: build pipeline', () => {
const actual = buildPipelineVisFunction.tagcloud({ params }, schemas);
expect(actual).toMatchSnapshot();
});
it('with boolean param showLabel', () => {
const schemas = { metric: [{ accessor: 0 }] };
const params = { showLabel: false };
const actual = buildPipelineVisFunction.tagcloud({ params }, schemas);
expect(actual).toMatchSnapshot();
});
});
describe('handles region_map function', () => {

View file

@ -267,7 +267,7 @@ export const buildPipelineVisFunction: BuildPipelineVisFunction = {
if (maxFontSize) {
expr += `maxFontSize=${maxFontSize} `;
}
if (showLabel) {
if (showLabel !== undefined) {
expr += `showLabel=${showLabel} `;
}