Client - display workout chart with dark mode colors when enabled

This commit is contained in:
Sam
2023-12-16 21:41:29 +01:00
parent e587babe78
commit bebf1dab9f
3 changed files with 105 additions and 9 deletions

View File

@ -21,7 +21,7 @@ describe('getDatasets', () => {
datasets: {
speed: {
label: 'vitesse',
backgroundColor: ['#FFFFFF'],
backgroundColor: ['transparent'],
borderColor: ['#8884d8'],
borderWidth: 2,
data: [],
@ -81,7 +81,7 @@ describe('getDatasets', () => {
datasets: {
speed: {
label: 'speed',
backgroundColor: ['#FFFFFF'],
backgroundColor: ['transparent'],
borderColor: ['#8884d8'],
borderWidth: 2,
data: [2.89, 20.64, 13.03],
@ -145,7 +145,7 @@ describe('getDatasets', () => {
datasets: {
speed: {
label: 'speed',
backgroundColor: ['#FFFFFF'],
backgroundColor: ['transparent'],
borderColor: ['#8884d8'],
borderWidth: 2,
data: [1.8, 12.83, 8.1],
@ -183,6 +183,90 @@ describe('getDatasets', () => {
})
})
describe('getDatasets with dark mode', () => {
const testparams = [
{
description: 'it returns dark mode color',
inputParams: {
charData: [],
locale: 'fr',
useImperialUnits: false,
useDarkMode: true,
},
expected: {
distance_labels: [],
duration_labels: [],
datasets: {
speed: {
label: 'vitesse',
backgroundColor: ['transparent'],
borderColor: ['#5f5c97'],
borderWidth: 2,
data: [],
yAxisID: 'ySpeed',
},
elevation: {
label: 'altitude',
backgroundColor: ['#303030'],
borderColor: ['#222222'],
borderWidth: 1,
fill: true,
data: [],
yAxisID: 'yElevation',
},
},
coordinates: [],
},
},
{
description: 'it returns light mode color',
inputParams: {
charData: [],
locale: 'fr',
useImperialUnits: false,
useDarkMode: false,
},
expected: {
distance_labels: [],
duration_labels: [],
datasets: {
speed: {
label: 'vitesse',
backgroundColor: ['transparent'],
borderColor: ['#8884d8'],
borderWidth: 2,
data: [],
yAxisID: 'ySpeed',
},
elevation: {
label: 'altitude',
backgroundColor: ['#e5e5e5'],
borderColor: ['#cccccc'],
borderWidth: 1,
fill: true,
data: [],
yAxisID: 'yElevation',
},
},
coordinates: [],
},
},
]
testparams.map((testParams) => {
it(testParams.description, () => {
locale.value = testParams.inputParams.locale
expect(
getDatasets(
testParams.inputParams.charData,
t,
testParams.inputParams.useImperialUnits,
testParams.inputParams.useDarkMode
)
).toStrictEqual(testParams.expected)
})
})
})
describe('getDonutDatasets', () => {
const testparams = [
{