Skip to content

Commit d38e6ec

Browse files
committed
test(ix-component): use vue 3 syntax
This commit updates `imgix-component.spec.ts` to use `@testing-library/vue`'s new beta syntax. This means renaming `propsData` to `props`. The commit also updates the Vue app syntax to use the new Global API from vue 3. For more context on this change see here: testing-library/vue-testing-library#137
1 parent 05e0491 commit d38e6ec

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/unit/imgix-component.spec.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
import { createApp } from 'vue';
12
import VueImgix, { IxImg } from '@/plugins/vue-imgix';
23
import '@testing-library/jest-dom';
34
import { render } from '@testing-library/vue';
4-
import Vue from 'vue';
5+
import _App from '../../src/App.vue';
56
import {
67
expectElementToHaveFixedSrcAndSrcSet,
78
expectElementToHaveFluidSrcAndSrcSet,
89
} from '../helpers/url-assert';
10+
11+
const App = createApp(_App);
12+
913
describe('imgix component', () => {
1014
beforeAll(() => {
11-
Vue.use(VueImgix, {
15+
App.use(VueImgix, {
1216
domain: 'assets.imgix.net',
1317
});
1418
});
@@ -25,7 +29,7 @@ describe('imgix component', () => {
2529
});
2630
it(`the rendered img's src should be set`, () => {
2731
const wrapper = render(IxImg, {
28-
propsData: {
32+
props: {
2933
src: 'examples/pione.jpg',
3034
dataTestId: 'img-rendering',
3135
},
@@ -38,7 +42,7 @@ describe('imgix component', () => {
3842
});
3943
it(`the rendered img's srcset should be set correctly`, () => {
4044
const wrapper = render(IxImg, {
41-
propsData: {
45+
props: {
4246
src: 'examples/pione.jpg',
4347
dataTestId: 'img-rendering',
4448
},
@@ -198,14 +202,14 @@ describe('imgix component', () => {
198202
};
199203
const ImgixClient = require('@imgix/js-core');
200204
ImgixClient.mockImplementation(() => mockImgixClient);
201-
_Vue.use(_VueImgix, {
205+
_App.use(_VueImgix, {
202206
domain: 'assets.imgix.net',
203207
});
204208
/* eslint-enable @typescript-eslint/no-var-requires */
205209
});
206210
it('should not pass disableVariableQuality: true to @imgix/js-core by default', () => {
207211
render(_IxImg, {
208-
propsData: {
212+
props: {
209213
src: 'examples/pione.jpg',
210214
height: 100,
211215
fixed: true,
@@ -222,7 +226,7 @@ describe('imgix component', () => {
222226
});
223227
it('should pass disableVariableQuality: true to @imgix/js-core when disableVariableQuality prop set', () => {
224228
render(_IxImg, {
225-
propsData: {
229+
props: {
226230
src: 'examples/pione.jpg',
227231
height: 100,
228232
disableVariableQuality: true,

0 commit comments

Comments
 (0)