Skip to content

Commit

Permalink
test(VImg): don't use expose()
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Mar 2, 2021
1 parent 0cb8568 commit d95a5f0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/vuetify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@types/jest": "^26.0.14",
"@types/node": "^14.11.10",
"@vue/babel-plugin-jsx": "^1.0.2",
"@vue/test-utils": "^2.0.0-beta.7",
"@vue/test-utils": "^2.0.0-rc.2",
"autoprefixer": "^9.6.1",
"babel-loader": "^8.0.6",
"babel-plugin-add-import-extension": "^1.4.3",
Expand Down
8 changes: 6 additions & 2 deletions packages/vuetify/src/components/VImg/VImg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import './VImg.sass'
import {
computed,
defineComponent,
getCurrentInstance,
h,
nextTick,
onBeforeMount,
reactive,
ref,
vShow,
watch,
Expand Down Expand Up @@ -74,14 +76,16 @@ export default defineComponent({

emits: ['loadstart', 'load', 'error'],

setup (props, { emit, expose, slots }) {
setup (props, { emit, slots }) {
const currentSrc = ref('') // Set from srcset
const image = ref<HTMLImageElement>()
const state = ref<'idle' | 'loading' | 'loaded' | 'error'>('idle')
const naturalWidth = ref<number>()
const naturalHeight = ref<number>()

expose({
// TODO: use expose() https://github.com/vuejs/vue-test-utils-next/issues/435
const vm = getCurrentInstance() as any
vm.setupState = reactive({
currentSrc,
image,
state,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4799,10 +4799,10 @@
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.7.tgz#96d52988efc07444c108c7c6803ba7cc93e40045"
integrity sha512-dn5FyfSc4ky424jH4FntiHno7Ss5yLkqKNmM/NXwANRnlkmqu74pnGetexDFVG5phMk9/FhwovUZCWGxsotVKg==

"@vue/test-utils@^2.0.0-beta.7":
version "2.0.0-beta.7"
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.0-beta.7.tgz#27751991e0b013ee4af487e51e16a58d477e5857"
integrity sha512-cAe7VqoxxkxTr/2N93UpW/LQbcUVKC+QRA3ZBq5ZWImtAf/8jtcdC2mQ9g4AKmSvyaKQtqxrRn4i/y5z7yrrKA==
"@vue/test-utils@^2.0.0-rc.2":
version "2.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.0-rc.2.tgz#a43cb6d1a30d16bb50fa3561397ba1e252683f9d"
integrity sha512-doOtnkleRTiN5rk+Losawe9/8i//8rncZ3lIhz/1vnONHDnthF1XjlI7pGZ1RV5uZJ3IUt3yVjwY7W6q9WhlRw==

"@vue/web-component-wrapper@^1.2.0":
version "1.2.0"
Expand Down

0 comments on commit d95a5f0

Please sign in to comment.