fix: Use HA style and coloring for all icons (#1790)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user