feat: Allow user generated notifications (#2401)
This commit is contained in:
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user