test(js): add vitest
This commit is contained in:
parent
222cb1e557
commit
2c3503d7d0
7 changed files with 505 additions and 17 deletions
29
app/javascript/shared/utils.test.ts
Normal file
29
app/javascript/shared/utils.test.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { suite, test, expect } from 'vitest';
|
||||
|
||||
import { show, hide, toggle } from './utils';
|
||||
|
||||
suite('@utils', () => {
|
||||
test('show', () => {
|
||||
const input = document.createElement('input');
|
||||
input.classList.add('hidden');
|
||||
|
||||
show(input);
|
||||
expect(input.classList.contains('hidden')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('hide', () => {
|
||||
const input = document.createElement('input');
|
||||
|
||||
hide(input);
|
||||
expect(input.classList.contains('hidden')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('toggle', () => {
|
||||
const input = document.createElement('input');
|
||||
|
||||
toggle(input);
|
||||
expect(input.classList.contains('hidden')).toBeTruthy();
|
||||
toggle(input);
|
||||
expect(input.classList.contains('hidden')).toBeFalsy();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue