From 9c91e74a3c24fc435c020f516ec39552427df7d4 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Mon, 8 Jun 2020 11:22:39 -0500 Subject: [PATCH] fix: broken tests, update prop naming --- src/components/chart.tsx | 4 ++-- src/components/chart_background.tsx | 10 +++++----- src/utils/chart_size.test.ts | 13 ------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/components/chart.tsx b/src/components/chart.tsx index 872c3c15d8..fded2da8dd 100644 --- a/src/components/chart.tsx +++ b/src/components/chart.tsx @@ -147,7 +147,7 @@ export class Chart extends React.Component { render() { const { size, className } = this.props; - const containerStyle = getChartSize(size); + const containerSizeStyle = getChartSize(size); const horizontal = isHorizontalAxis(this.state.legendPosition); const chartClassNames = classNames('echChart', className, { 'echChart--column': horizontal, @@ -155,7 +155,7 @@ export class Chart extends React.Component { return ( -
+
diff --git a/src/components/chart_background.tsx b/src/components/chart_background.tsx index 6527061b6e..082b20e104 100644 --- a/src/components/chart_background.tsx +++ b/src/components/chart_background.tsx @@ -22,7 +22,7 @@ import { GlobalChartState } from '../state/chart_state'; import { getInternalIsInitializedSelector } from '../state/selectors/get_internal_is_intialized'; interface ChartBackgroundProps { - background: string; + backgroundColor: string; } export class ChartBackgroundComponent extends React.Component { @@ -33,19 +33,19 @@ export class ChartBackgroundComponent extends React.Component; + const { backgroundColor } = this.props; + return
; } } const mapStateToProps = (state: GlobalChartState): ChartBackgroundProps => { if (!getInternalIsInitializedSelector(state)) { return { - background: 'transparent', + backgroundColor: 'transparent', }; } return { - background: getChartThemeSelector(state).background.color, + backgroundColor: getChartThemeSelector(state).background.color, }; }; diff --git a/src/utils/chart_size.test.ts b/src/utils/chart_size.test.ts index 8b3ce694dc..6c2adb89d6 100644 --- a/src/utils/chart_size.test.ts +++ b/src/utils/chart_size.test.ts @@ -21,71 +21,58 @@ import { getChartSize } from './chart_size'; describe('chart size utilities', () => { test('array', () => { expect(getChartSize([100, 100])).toEqual({ - position: 'relative', width: 100, height: 100, }); expect(getChartSize([undefined, 100])).toEqual({ - position: 'relative', width: '100%', height: 100, }); expect(getChartSize([100, undefined])).toEqual({ - position: 'relative', width: 100, height: '100%', }); expect(getChartSize([undefined, undefined])).toEqual({ - position: 'relative', width: '100%', height: '100%', }); expect(getChartSize([0, '100em'])).toEqual({ - position: 'relative', width: 0, height: '100em', }); }); test('value', () => { expect(getChartSize(1)).toEqual({ - position: 'relative', width: 1, height: 1, }); expect(getChartSize('100em')).toEqual({ - position: 'relative', width: '100em', height: '100em', }); expect(getChartSize(0)).toEqual({ - position: 'relative', width: 0, height: 0, }); }); test('object', () => { expect(getChartSize({ width: 100, height: 100 })).toEqual({ - position: 'relative', width: 100, height: 100, }); expect(getChartSize({ height: 100 })).toEqual({ - position: 'relative', width: '100%', height: 100, }); expect(getChartSize({ width: 100 })).toEqual({ - position: 'relative', width: 100, height: '100%', }); expect(getChartSize({})).toEqual({ - position: 'relative', width: '100%', height: '100%', }); expect(getChartSize({ width: 0, height: '100em' })).toEqual({ - position: 'relative', width: 0, height: '100em', });