1
+ import { createApp } from 'vue' ;
1
2
import VueImgix , { IxImg } from '@/plugins/vue-imgix' ;
2
3
import '@testing-library/jest-dom' ;
3
4
import { render } from '@testing-library/vue' ;
4
- import Vue from 'vue' ;
5
+ import _App from '../../src/App. vue' ;
5
6
import {
6
7
expectElementToHaveFixedSrcAndSrcSet ,
7
8
expectElementToHaveFluidSrcAndSrcSet ,
8
9
} from '../helpers/url-assert' ;
10
+
11
+ const App = createApp ( _App ) ;
12
+
9
13
describe ( 'imgix component' , ( ) => {
10
14
beforeAll ( ( ) => {
11
- Vue . use ( VueImgix , {
15
+ App . use ( VueImgix , {
12
16
domain : 'assets.imgix.net' ,
13
17
} ) ;
14
18
} ) ;
15
19
it ( 'an img should be rendered' , ( ) => {
16
20
const wrapper = render ( IxImg , {
17
- propsData : {
21
+ props : {
18
22
src : 'examples/pione.jpg' ,
19
23
'data-testid' : 'img-rendering' ,
20
24
} ,
@@ -24,7 +28,7 @@ describe('imgix component', () => {
24
28
} ) ;
25
29
it ( `the rendered img's src should be set` , ( ) => {
26
30
const wrapper = render ( IxImg , {
27
- propsData : {
31
+ props : {
28
32
src : 'examples/pione.jpg' ,
29
33
'data-testid' : 'img-rendering' ,
30
34
} ,
@@ -37,7 +41,7 @@ describe('imgix component', () => {
37
41
} ) ;
38
42
it ( `the rendered img's srcset should be set correctly` , ( ) => {
39
43
const wrapper = render ( IxImg , {
40
- propsData : {
44
+ props : {
41
45
src : 'examples/pione.jpg' ,
42
46
'data-testid' : 'img-rendering' ,
43
47
} ,
@@ -60,7 +64,7 @@ describe('imgix component', () => {
60
64
61
65
it ( 'imgixParams should be set on the rendered src and srcset' , ( ) => {
62
66
const wrapper = render ( IxImg , {
63
- propsData : {
67
+ props : {
64
68
'data-testid' : 'img-rendering' ,
65
69
src : 'examples/pione.jpg' ,
66
70
imgixParams : { crop : 'faces' } ,
@@ -80,7 +84,7 @@ describe('imgix component', () => {
80
84
describe ( 'in fluid mode (no fixed props set)' , ( ) => {
81
85
it ( 'ix-img should render a fluid image if width is passed as attribute' , ( ) => {
82
86
const wrapper = render ( IxImg , {
83
- propsData : {
87
+ props : {
84
88
'data-testid' : 'img-rendering' ,
85
89
src : 'examples/pione.jpg' ,
86
90
width : 100 ,
@@ -95,7 +99,7 @@ describe('imgix component', () => {
95
99
describe ( 'in fixed mode (fixed prop set, or width/height passed to imgixParams)' , ( ) => {
96
100
it ( 'the src and srcset should be in fixed size mode when a width is passed to imgixParams' , ( ) => {
97
101
const wrapper = render ( IxImg , {
98
- propsData : {
102
+ props : {
99
103
'data-testid' : 'img-rendering' ,
100
104
src : 'examples/pione.jpg' ,
101
105
imgixParams : {
@@ -109,7 +113,7 @@ describe('imgix component', () => {
109
113
} ) ;
110
114
it ( 'the src and srcset should be in fixed size mode when a fixed prop is passed to the element' , ( ) => {
111
115
const wrapper = render ( IxImg , {
112
- propsData : {
116
+ props : {
113
117
'data-testid' : 'img-rendering' ,
114
118
src : 'examples/pione.jpg' ,
115
119
width : 100 ,
@@ -127,7 +131,7 @@ describe('imgix component', () => {
127
131
128
132
it ( 'a width attribute should be passed through to the underlying component' , ( ) => {
129
133
const wrapper = render ( IxImg , {
130
- propsData : {
134
+ props : {
131
135
'data-testid' : 'img-rendering' ,
132
136
src : 'examples/pione.jpg' ,
133
137
width : 100 ,
@@ -141,7 +145,7 @@ describe('imgix component', () => {
141
145
} ) ;
142
146
it ( 'a height attribute should be passed through to the underlying component' , ( ) => {
143
147
const wrapper = render ( IxImg , {
144
- propsData : {
148
+ props : {
145
149
'data-testid' : 'img-rendering' ,
146
150
src : 'examples/pione.jpg' ,
147
151
height : 100 ,
@@ -160,7 +164,7 @@ describe('imgix component', () => {
160
164
ATTRIBUTES . forEach ( ( attribute ) => {
161
165
it ( `${ attribute } can be configured to use data-${ attribute } ` , ( ) => {
162
166
const wrapper = render ( IxImg , {
163
- propsData : {
167
+ props : {
164
168
'data-testid' : 'img-rendering' ,
165
169
src : 'examples/pione.jpg' ,
166
170
attributeConfig : {
@@ -197,14 +201,14 @@ describe('imgix component', () => {
197
201
} ;
198
202
const ImgixClient = require ( 'imgix-core-js' ) ;
199
203
ImgixClient . mockImplementation ( ( ) => mockImgixClient ) ;
200
- _Vue . use ( _VueImgix , {
204
+ _App . use ( _VueImgix , {
201
205
domain : 'assets.imgix.net' ,
202
206
} ) ;
203
207
/* eslint-enable @typescript-eslint/no-var-requires */
204
208
} ) ;
205
209
it ( 'should not pass disableVariableQuality: true to imgix-core-js by default' , ( ) => {
206
210
render ( _IxImg , {
207
- propsData : {
211
+ props : {
208
212
src : 'examples/pione.jpg' ,
209
213
height : 100 ,
210
214
fixed : true ,
@@ -221,7 +225,7 @@ describe('imgix component', () => {
221
225
} ) ;
222
226
it ( 'should pass disableVariableQuality: true to imgix-core-js when disableVariableQuality prop set' , ( ) => {
223
227
render ( _IxImg , {
224
- propsData : {
228
+ props : {
225
229
src : 'examples/pione.jpg' ,
226
230
height : 100 ,
227
231
disableVariableQuality : true ,
0 commit comments