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
| import { describe, expect, it } from 'vitest';
|
| import { defaultInputClickEventScript, getInputClickEventScript, getVisibleFieldEvents } from './fieldEvent';
|
| describe('getInputClickEventScript', () => {
| it('uses the configured click script', () => {
| expect(getInputClickEventScript({ click: 'custom click script' })).toBe('custom click script');
| });
|
| it('uses the default script without creating a click configuration', () => {
| const events = { blur: 'blur script', change: 'change script' };
|
| expect(getInputClickEventScript(events)).toBe(defaultInputClickEventScript);
| expect(events).not.toHaveProperty('click');
| });
| });
|
| describe('getVisibleFieldEvents', () => {
| it('excludes click from the generic input event list', () => {
| expect(getVisibleFieldEvents({ blur: 'blur', change: 'change', click: 'click' }, true)).toEqual([
| ['blur', 'blur'],
| ['change', 'change'],
| ]);
| });
|
| it('keeps click in generic event lists for other components', () => {
| expect(getVisibleFieldEvents({ click: 'click' }, false)).toEqual([['click', 'click']]);
| });
| });
|
|