-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes to make jest 27 work and spec file updates
- Loading branch information
1 parent
0e38285
commit cd16a94
Showing
7 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
"test": "jest" | ||
}, | ||
"jest": { | ||
"testEnvironment": "jsdom", | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { mount } from '@vue/test-utils' | ||
import LightBox from '@/LightBox' | ||
|
||
import { mediaWithOneVideoWithAutoplay } from '../props' | ||
|
||
describe('LightBox', () => { | ||
describe('given one video with autoplay in the media array', () => { | ||
let wrapper | ||
|
||
const pauseStub = jest | ||
.spyOn(window.HTMLMediaElement.prototype, 'pause') | ||
.mockImplementation(() => {}) | ||
const playStub = jest | ||
.spyOn(window.HTMLMediaElement.prototype, 'play') | ||
.mockImplementation(() => {}) | ||
|
||
beforeEach(() => { | ||
wrapper = mount(LightBox, { | ||
propsData: { | ||
media: mediaWithOneVideoWithAutoplay | ||
} | ||
}) | ||
}) | ||
|
||
afterEach(() => { | ||
wrapper.destroy() | ||
}) | ||
|
||
describe('showImage', () => { | ||
test('calls play on the video', () => { | ||
expect(playStub).toHaveBeenCalled() | ||
}) | ||
}) | ||
|
||
describe('closeLightBox', () => { | ||
test('calls pause on the video', async () => { | ||
wrapper.vm.closeLightBox() | ||
expect(pauseStub).toHaveBeenCalledTimes(1) | ||
}) | ||
}) | ||
}) | ||
}) |
6 changes: 3 additions & 3 deletions
6
specs/LightBox/MediaArrayOneVideo.spec.js → ...MediaArrayOneVideoWithoutAutoplay.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters