From 7687e0d9543ec50bca47a36334451c0d5ad525c3 Mon Sep 17 00:00:00 2001 From: Trevor North Date: Sat, 18 May 2024 15:28:20 +0100 Subject: [PATCH] Fix moon phase translation key --- src/utils/HelperFunctions.ts | 2 +- tests/unit/components/horizonCard/HorizonCardFooter.spec.ts | 3 ++- .../horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap | 4 ++-- tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/utils/HelperFunctions.ts b/src/utils/HelperFunctions.ts index b59d449..6c8093a 100644 --- a/src/utils/HelperFunctions.ts +++ b/src/utils/HelperFunctions.ts @@ -29,7 +29,7 @@ export class HelperFunctions { return nothing } - let moon_phase_localized: unknown = i18n.localize(`component.entity.sensor.phase.state.${phase.state}`) + let moon_phase_localized: unknown = i18n.localize(`component.moon.entity.sensor.phase.state.${phase.state}`) if (!moon_phase_localized) { moon_phase_localized = html`${phase.state} (!)` } diff --git a/tests/unit/components/horizonCard/HorizonCardFooter.spec.ts b/tests/unit/components/horizonCard/HorizonCardFooter.spec.ts index 145f5c2..d7e640a 100644 --- a/tests/unit/components/horizonCard/HorizonCardFooter.spec.ts +++ b/tests/unit/components/horizonCard/HorizonCardFooter.spec.ts @@ -1,6 +1,7 @@ import { NumberFormat, TimeFormat } from 'custom-card-helpers' import { HorizonCardFooter } from '../../../../src/components/horizonCard' +import { Constants } from '../../../../src/constants' import { IHorizonCardConfig, THorizonCardData } from '../../../../src/types' import { I18N } from '../../../../src/utils/I18N' import { TemplateResultTestHelper } from '../../../helpers/TestHelpers' @@ -61,7 +62,7 @@ describe('HorizonCardFooter', () => { if (field.startsWith('moon_')) { const name = field.substring('moon_'.length) if (name === 'phase') { - data.moonData[name] = 'full_moon' + data.moonData[name] = Constants.MOON_PHASES.fullMoon data.moonData['phaseRotation'] = 0 } else { data.moonData[name] = 0 diff --git a/tests/unit/components/horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap b/tests/unit/components/horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap index 123c5e9..50ac0c2 100644 --- a/tests/unit/components/horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap +++ b/tests/unit/components/horizonCard/__snapshots__/HorizonCardFooter.spec.ts.snap @@ -192,11 +192,11 @@ exports[`HorizonCardFooter render should render the moon_phase field when it is
- +
- component.sensor.state.moon__phase.undefined + component.moon.entity.sensor.phase.state.full_moon
diff --git a/tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap b/tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap index 3ad5562..b52cbd7 100644 --- a/tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap +++ b/tests/unit/utils/__snapshots__/HelperFunctions.spec.ts.snap @@ -25,7 +25,7 @@ exports[`HelperFunctions renderFieldElement returns a field element template whe
- component.sensor.state.moon__phase.full_moon + component.moon.entity.sensor.phase.state.full_moon
`;