feat: Allow user generated notifications (#2401)

This commit is contained in:
Dermot Duffy
2026-03-07 20:47:24 -08:00
committed by GitHub
parent 1d81e03b04
commit 24c6b98948
53 changed files with 939 additions and 471 deletions
@@ -28,7 +28,7 @@ describe('InfoAction', () => {
await action.execute(api);
expect(api.getOverlayMessageManager().setMessage).toBeCalled();
expect(api.getNotificationManager().setNotification).toBeCalled();
});
it('should not handle info action without media', async () => {
@@ -45,6 +45,6 @@ describe('InfoAction', () => {
await action.execute(api);
expect(api.getOverlayMessageManager().setMessage).not.toBeCalled();
expect(api.getNotificationManager().setNotification).not.toBeCalled();
});
});
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest';
import { NotificationAction } from '../../../../src/card-controller/actions/actions/notification';
import { createCardAPI } from '../../../test-utils';
describe('NotificationAction', () => {
it('should set notification on manager', async () => {
const api = createCardAPI();
const notification = {
heading: { text: 'Test Heading' },
text: 'Test text',
};
const action = new NotificationAction(
{},
{
action: 'fire-dom-event',
advanced_camera_card_action: 'notification',
notification,
},
);
await action.execute(api);
expect(api.getNotificationManager().setNotification).toHaveBeenCalledWith(
notification,
);
});
});
@@ -22,9 +22,10 @@ import { MoreInfoAction } from '../../../src/card-controller/actions/actions/mor
import { MuteAction } from '../../../src/card-controller/actions/actions/mute';
import { NavigateAction } from '../../../src/card-controller/actions/actions/navigate';
import { NoneAction } from '../../../src/card-controller/actions/actions/none';
import { NotificationAction } from '../../../src/card-controller/actions/actions/notification';
import { PauseAction } from '../../../src/card-controller/actions/actions/pause';
import { PIPAction } from '../../../src/card-controller/actions/actions/pip';
import { PerformActionAction } from '../../../src/card-controller/actions/actions/perform-action';
import { PIPAction } from '../../../src/card-controller/actions/actions/pip';
import { PlayAction } from '../../../src/card-controller/actions/actions/play';
import { PTZAction } from '../../../src/card-controller/actions/actions/ptz';
import { PTZControlsAction } from '../../../src/card-controller/actions/actions/ptz-controls';
@@ -126,6 +127,13 @@ describe('ActionFactory', () => {
},
LogAction,
],
[
{
advanced_camera_card_action: 'notification' as const,
notification: { text: 'test' },
},
NotificationAction,
],
[
{
advanced_camera_card_action: 'media_player' as const,