From 70019553b56ae8476982a1bb7fc6dc74a3640a96 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 3 Nov 2020 17:23:43 +0100 Subject: [PATCH 1/2] add functional test for wrapping labels --- x-pack/plugins/lens/public/plugin.ts | 2 +- .../test/functional/apps/lens/smokescreen.ts | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index dddbadec00cf8..f6785d83ae3da 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -5,7 +5,7 @@ */ import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; -import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; +import { DataPublicPluginSetup, DataPublicPluginStart, FieldFormat } from 'src/plugins/data/public'; import { EmbeddableSetup, EmbeddableStart } from 'src/plugins/embeddable/public'; import { DashboardStart } from 'src/plugins/dashboard/public'; import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/public'; diff --git a/x-pack/test/functional/apps/lens/smokescreen.ts b/x-pack/test/functional/apps/lens/smokescreen.ts index 0ddafe581c21d..58ae4dc25885a 100644 --- a/x-pack/test/functional/apps/lens/smokescreen.ts +++ b/x-pack/test/functional/apps/lens/smokescreen.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'lens', 'common']); + const PageObjects = getPageObjects(['visualize', 'lens', 'common', 'header']); const find = getService('find'); const listingTable = getService('listingTable'); const testSubjects = getService('testSubjects'); @@ -169,6 +169,25 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await PageObjects.lens.getDimensionTriggerText('lnsXY_yDimensionPanel')).to.eql( 'Test of label' ); + await PageObjects.lens.closeDimensionEditor(); + }); + + it('should be able to add very long labels and still be able to remove a dimension', async () => { + await PageObjects.lens.openDimensionEditor('lnsXY_yDimensionPanel > lns-dimensionTrigger'); + const longLabel = + 'Veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryvery long label wrapping multiple lines'; + await PageObjects.lens.editDimensionLabel(longLabel); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.closeDimensionEditor(); + + expect(await PageObjects.lens.getDimensionTriggerText('lnsXY_yDimensionPanel')).to.eql( + longLabel + ); + expect( + await testSubjects.isDisplayed('lnsXY_yDimensionPanel > indexPattern-dimension-remove') + ).to.equal(true); + await PageObjects.lens.removeDimension('lnsXY_yDimensionPanel'); + await testSubjects.missingOrFail('lnsXY_yDimensionPanel > lns-dimensionTrigger'); }); it('should transition from a multi-layer stacked bar to donut chart using suggestions', async () => { From 78bc475ee347c5f96549a9153fcafd1508ff151b Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 3 Nov 2020 17:45:45 +0100 Subject: [PATCH 2/2] fix unused import --- x-pack/plugins/lens/public/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index f6785d83ae3da..dddbadec00cf8 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -5,7 +5,7 @@ */ import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; -import { DataPublicPluginSetup, DataPublicPluginStart, FieldFormat } from 'src/plugins/data/public'; +import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; import { EmbeddableSetup, EmbeddableStart } from 'src/plugins/embeddable/public'; import { DashboardStart } from 'src/plugins/dashboard/public'; import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/public';