UI-tests und fixes aus tests
This commit is contained in:
1 parent
73da8fb849
commit
968d980be1
46 files changed
+3853
-61
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { describe, it, afterEach, expect, $, click, type, pressKey, sleep, closeAll } from './runner.js';
|
||||
|
||||
describe('Search', () => {
|
||||
afterEach(() => closeAll());
|
||||
|
||||
it('opens with Ctrl+K', async () => {
|
||||
pressKey('k', { ctrlKey: true });
|
||||
await sleep(150);
|
||||
expect($('#search')).toBeVisible();
|
||||
});
|
||||
|
||||
it('opens with search button', async () => {
|
||||
click('#search-btn');
|
||||
await sleep(150);
|
||||
expect($('#search')).toBeVisible();
|
||||
});
|
||||
|
||||
it('input is focused on open', async () => {
|
||||
click('#search-btn');
|
||||
await sleep(150);
|
||||
expect(document.activeElement).toBe($('#search-input'));
|
||||
});
|
||||
|
||||
it('has input and results area', async () => {
|
||||
click('#search-btn');
|
||||
await sleep(100);
|
||||
expect($('#search-input')).toExist();
|
||||
expect($('#search-results')).toExist();
|
||||
});
|
||||
|
||||
it('typing triggers results render', async () => {
|
||||
click('#search-btn');
|
||||
await sleep(100);
|
||||
type('#search-input', 'a');
|
||||
await sleep(250);
|
||||
expect($('#search-results')).toExist();
|
||||
});
|
||||
|
||||
it('closes with ESC', async () => {
|
||||
click('#search-btn');
|
||||
await sleep(100);
|
||||
pressKey('Escape');
|
||||
await sleep(150);
|
||||
expect($('#search')).toBeHidden();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user