forked from ctrl-freaks/freezeframe.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce161a2
commit 35f14ff
Showing
3 changed files
with
43 additions
and
13 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
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
packages/vue-freezeframe/tests/unit/vue-freezeframe.spec.ts
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 { shallowMount } from '@vue/test-utils' | ||
import VueFreezeframe from '@/components/VueFreezeframe.vue' | ||
|
||
const src = 'http://localhost:8080/foo.gif' | ||
|
||
describe('VueFreezeframe.vue', () => { | ||
it('renders image when url is passed into src prop', () => { | ||
const wrapper = shallowMount(VueFreezeframe, { | ||
propsData: { src }, | ||
}) | ||
const img = wrapper.find('img') | ||
expect(img.exists()).toBe(true) | ||
expect(img.attributes('src')).toEqual(src) | ||
expect(wrapper.classes()).toContain('vue-freezeframe') | ||
}) | ||
|
||
it('renders image when img is passed into default slot', () => { | ||
const wrapper = shallowMount(VueFreezeframe, { | ||
slots: { | ||
default: [`<img src="${src}" />`], | ||
} | ||
}) | ||
const img = wrapper.find('img') | ||
expect(img.exists()).toBe(true) | ||
expect(img.attributes('src')).toEqual(src) | ||
expect(wrapper.classes()).toContain('vue-freezeframe') | ||
}) | ||
|
||
it('renders images when multiple imgs are passed into default slot', () => { | ||
const wrapper = shallowMount(VueFreezeframe, { | ||
slots: { | ||
default: [ | ||
`<img src="${src}" /><img src="${src}" /><img src="${src}" />` | ||
], | ||
} | ||
}) | ||
const imgs = wrapper.findAll('img') | ||
expect(imgs.length).toBe(3) | ||
expect(imgs.at(0).attributes('src')).toEqual(src) | ||
expect(wrapper.classes()).toContain('vue-freezeframe') | ||
}) | ||
}) |