fix: Use HA style and coloring for all icons (#1790)

This commit is contained in:
Dermot Duffy
2024-12-23 15:22:27 -08:00
committed by GitHub
parent a9e5889ca7
commit 9d812af9f4
68 changed files with 557 additions and 1366 deletions
-27
View File
@@ -1,27 +0,0 @@
import { describe, expect, it } from 'vitest';
import frigateSVG from '../../src/camera-manager/frigate/assets/frigate.svg';
import motioneyeSVG from '../../src/camera-manager/motioneye/assets/motioneye.svg';
import reolinkSVG from '../../src/camera-manager/reolink/assets/reolink.svg';
import { getCustomIconURL } from '../../src/utils/custom-icons';
describe('getCustomIconURL', () => {
it('should return frigate SVG for frigate icon', () => {
expect(getCustomIconURL('frigate')).toBe(frigateSVG);
});
it('should return motioneye SVG for motioneye icon', () => {
expect(getCustomIconURL('motioneye')).toBe(motioneyeSVG);
});
it('should return reolink SVG for reolink icon', () => {
expect(getCustomIconURL('reolink')).toBe(reolinkSVG);
});
it('should return null for mdi icon', () => {
expect(getCustomIconURL('mdi:car')).toBeNull();
});
it('should return null for undefined icon', () => {
expect(getCustomIconURL()).toBeNull();
});
});
+1 -23
View File
@@ -2,11 +2,10 @@ import { HomeAssistant } from '@dermotduffy/custom-card-helpers';
import { describe, expect, it, vi } from 'vitest';
import {
canonicalizeHAURL,
getEntityIcon,
hasHAConnectionStateChanged,
isHARelativeURL,
} from '../../../src/utils/ha/index.js';
import { createHASS, createStateEntity } from '../../test-utils.js';
import { createHASS } from '../../test-utils.js';
const createConnected = (connected: boolean): HomeAssistant => {
const hass = createHASS();
@@ -49,27 +48,6 @@ describe('hasHAConnectionStateChanged', () => {
});
});
describe('getEntityIcon', () => {
it('should get icon from attributes', () => {
expect(
getEntityIcon(
createHASS({
'camera.test': createStateEntity({
attributes: {
icon: 'mdi:cow',
},
}),
}),
'camera.test',
),
).toBe('mdi:cow');
});
it('should get icon from domain', () => {
expect(getEntityIcon(createHASS(), 'camera.test')).toBe('mdi:video');
});
});
describe('isHARelativeURL', () => {
it('should return true when URL is HA relative', () => {
expect(isHARelativeURL('/api/foo')).toBeTruthy();