mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-28 06:17:46 +01:00
Add test
This commit is contained in:
parent
1669977dae
commit
e9316d41e2
1 changed files with 13 additions and 0 deletions
|
@ -369,6 +369,19 @@ describe('Image utils', () => {
|
|||
expect(mockShowElement).toHaveClass(spoilerPendingClass);
|
||||
});
|
||||
|
||||
it('should play the video if it is present', () => {
|
||||
const mockElement = document.createElement('div');
|
||||
const { mockShowElement } = createImageShowElement(mockElement);
|
||||
const mockVideo = document.createElement('video');
|
||||
mockShowElement.appendChild(mockVideo);
|
||||
|
||||
const playSpy = vi.spyOn(mockVideo, 'play').mockReturnValue(Promise.resolve());
|
||||
|
||||
showBlock(mockElement);
|
||||
|
||||
expect(playSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should not throw if image-filtered element is missing', () => {
|
||||
const mockElement = document.createElement('div');
|
||||
createImageShowElement(mockElement);
|
||||
|
|
Loading…
Add table
Reference in a new issue