Commit d40d69c1 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'fix/analysis-fixes' into 'dev'

fix(Analysis): fix css overflow issue and prevent display of total analysis when only one fluid

See merge request web-et-numerique/llle_project/ecolyo!485
parents 31cd5587 7faa1c13
......@@ -95,7 +95,7 @@ describe('TotalAnalysisChart component', () => {
analysisDate={DateTime.fromISO('2021-07-01T00:00:00.000Z', {
zone: 'utc',
})}
fluidTypes={[FluidType.ELECTRICITY]}
fluidTypes={[FluidType.ELECTRICITY, FluidType.WATER]}
/>
</Provider>
)
......@@ -105,4 +105,38 @@ describe('TotalAnalysisChart component', () => {
})
expect(wrapper.find('.fluidconso').text()).toBe('--- €')
})
it('should render empty price for one fluid', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
},
})
const emptyData = {
actualData: [
{
date: DateTime.fromISO('2020-09-01T00:00:00.000Z', {
zone: 'utc',
}),
value: 69.18029999999999,
valueDetail: [-1],
},
],
}
mockgetGraphData.mockResolvedValueOnce(emptyData)
const wrapper = mount(
<Provider store={store}>
<TotalAnalysisChart
analysisDate={DateTime.fromISO('2021-07-01T00:00:00.000Z', {
zone: 'utc',
})}
fluidTypes={[FluidType.ELECTRICITY]}
/>
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
expect(wrapper.find('.fluidconso').exists()).toBe(false)
})
})
......@@ -66,9 +66,7 @@ const TotalAnalysisChart: React.FC<TotalAnalysisChartProps> = ({
minHeight: radius + 100,
}}
>
{fluidTypes.length >= 2 && (
<div className="text-24-normal title">{t('analysis_pie.total')}</div>
)}
<div className="text-24-normal title">{t('analysis_pie.total')}</div>
{dataLoadArray && (
<PieChart
dataArray={dataLoadArray}
......@@ -82,7 +80,7 @@ const TotalAnalysisChart: React.FC<TotalAnalysisChartProps> = ({
.startOf('month')}
/>
)}
{dataLoadArray && (
{dataLoadArray && fluidTypes.length > 1 && (
<div className="total-card-container">
{dataLoadArray.map((load, index) => {
return (
......
......@@ -15,6 +15,7 @@
text-align: center;
position: relative;
margin: auto;
overflow: visible;
}
svg {
margin: auto;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment