From 4b72e62f63c7fa73db77d8b536d7b94af5b3a38e Mon Sep 17 00:00:00 2001 From: Ahmad Bamieh Date: Sun, 18 Oct 2020 19:29:07 +0300 Subject: [PATCH] call isSecurityExampleEnabled --- .../public/components/telemetry_management_section.test.tsx | 3 ++- .../public/components/telemetry_management_section.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx index edfd74bcd2f42..6bdbbe7307653 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx @@ -300,7 +300,8 @@ describe('TelemetryManagementSectionComponent', () => { ); try { - const description = component.instance().renderDescription({ securityExampleEnabled: false }); + const description = (component.instance() as TelemetryManagementSection).renderDescription(); + expect(isSecurityExampleEnabled).toBeCalled(); expect(description).toMatchSnapshot(); } finally { component.unmount(); diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx index 17963eb5630ef..688c8dd82e75b 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx @@ -136,7 +136,7 @@ export class TelemetryManagementSection extends Component { defaultMessage: 'Provide usage statistics', }), value: enabled, - description: this.renderDescription({ securityExampleEnabled }), + description: this.renderDescription(), defVal: true, ariaName: i18n.translate('telemetry.provideUsageStatisticsAriaName', { defaultMessage: 'Provide usage statistics', @@ -185,7 +185,9 @@ export class TelemetryManagementSection extends Component { ); }; - renderDescription = ({ securityExampleEnabled }: { securityExampleEnabled: boolean }) => { + renderDescription = () => { + const { isSecurityExampleEnabled } = this.props; + const securityExampleEnabled = isSecurityExampleEnabled(); const clusterDataLink = (