feat: Allow user generated notifications (#2401)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { iconSchema } from '../../../../src/config/schema/common/icon';
|
||||
|
||||
describe('iconSchema', () => {
|
||||
it('should parse icon with all fields', () => {
|
||||
expect(
|
||||
iconSchema.parse({
|
||||
icon: 'mdi:star',
|
||||
entity: 'light.office',
|
||||
stateColor: true,
|
||||
}),
|
||||
).toEqual({
|
||||
icon: 'mdi:star',
|
||||
entity: 'light.office',
|
||||
stateColor: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should parse empty object', () => {
|
||||
expect(iconSchema.parse({})).toEqual({});
|
||||
});
|
||||
});
|
||||
@@ -441,6 +441,10 @@ describe('config defaults', () => {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
},
|
||||
upgrade: {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
},
|
||||
},
|
||||
popup_seconds: 3,
|
||||
position: 'bottom',
|
||||
@@ -1066,6 +1070,30 @@ describe('config defaults', () => {
|
||||
action: 'custom:advanced-camera-card-action',
|
||||
advanced_camera_card_action: 'mute',
|
||||
},
|
||||
{
|
||||
action: 'custom:advanced-camera-card-action',
|
||||
advanced_camera_card_action: 'notification',
|
||||
notification: {
|
||||
heading: {
|
||||
text: 'Attention',
|
||||
icon: 'mdi:alert',
|
||||
severity: 'high',
|
||||
},
|
||||
text: 'Something happened.',
|
||||
details: [{ text: 'Detail 1', icon: 'mdi:info' }],
|
||||
controls: [
|
||||
{
|
||||
icon: 'mdi:check',
|
||||
tooltip: 'Acknowledge',
|
||||
dismiss: true,
|
||||
},
|
||||
{
|
||||
icon: 'mdi:eye',
|
||||
dismiss: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
action: 'custom:advanced-camera-card-action',
|
||||
advanced_camera_card_action: 'pause',
|
||||
|
||||
Reference in New Issue
Block a user