File size: 787 Bytes
7421850 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import { appEvents, AppEvent } from './events.js';
describe('events', () => {
it('should allow registering and emitting events', () => {
const callback = vi.fn();
appEvents.on(AppEvent.SelectionWarning, callback);
appEvents.emit(AppEvent.SelectionWarning);
expect(callback).toHaveBeenCalled();
appEvents.off(AppEvent.SelectionWarning, callback);
});
it('should work with events without data', () => {
const callback = vi.fn();
appEvents.on(AppEvent.Flicker, callback);
appEvents.emit(AppEvent.Flicker);
expect(callback).toHaveBeenCalled();
appEvents.off(AppEvent.Flicker, callback);
});
});
|