43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { describe, it, afterEach, expect, $, click, sleep, closeAll } from './runner.js?v=4';
|
|
|
|
describe('Gallery', () => {
|
|
afterEach(() => closeAll());
|
|
|
|
it('button exists', () => {
|
|
expect($('#gallery-btn')).toExist();
|
|
});
|
|
|
|
it('opens on button click', async () => {
|
|
click('#gallery-btn');
|
|
for (let i = 0; i < 20; i++) {
|
|
if ($('#gallery')?.classList.contains('open')) break;
|
|
await sleep(100);
|
|
}
|
|
expect($('#gallery')).toBeVisible();
|
|
});
|
|
|
|
it('grid has no text selection', () => {
|
|
expect($('#gallery-grid').classList.contains('select-none')).toBe(true);
|
|
});
|
|
|
|
it('shows image count', async () => {
|
|
click('#gallery-btn');
|
|
for (let i = 0; i < 20; i++) {
|
|
if ($('#gallery')?.classList.contains('open')) break;
|
|
await sleep(100);
|
|
}
|
|
expect($('#gallery-count')).toExist();
|
|
});
|
|
|
|
it('closes on close button', async () => {
|
|
click('#gallery-btn');
|
|
for (let i = 0; i < 20; i++) {
|
|
if ($('#gallery')?.classList.contains('open')) break;
|
|
await sleep(100);
|
|
}
|
|
click('#gallery-close');
|
|
await sleep(150);
|
|
expect($('#gallery')).toBeHidden();
|
|
});
|
|
});
|