-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuseTrigger.test.ts
More file actions
32 lines (24 loc) · 975 Bytes
/
useTrigger.test.ts
File metadata and controls
32 lines (24 loc) · 975 Bytes
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
import {describe, expect, it} from 'vitest';
import {triggerProps, triggers} from '.';
describe('triggerProps', () => {
describe('trigger', () => {
triggers.forEach((t) => {
it(`passes validation with ${t}`, () => {
const result = triggerProps.trigger.validator(t);
expect(result).toBe(true);
});
});
it('passes validation with a trigger array', () => {
const result = triggerProps.trigger.validator(['hover', 'focus']);
expect(result).toBe(true);
});
it('passes validation with a non trigger', () => {
const result = triggerProps.trigger.validator('non-trigger');
expect(result).toBe(false);
});
it('passes validation with a non trigger array', () => {
const result = triggerProps.trigger.validator(['click', 'non-trigger']);
expect(result).toBe(false);
});
});
});