-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from vuejs/lm/issue-263
Support latest <script setup>
- Loading branch information
Showing
5 changed files
with
107 additions
and
61 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 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,15 @@ | ||
<script setup lang="ts"> | ||
// imported components are also directly usable in template | ||
import { ref } from 'vue' | ||
import Hello from './Hello.vue' | ||
// write Composition API code just like in a normal setup() | ||
// but no need to manually return everything | ||
const count = ref(0) | ||
const inc = () => { count.value++ } | ||
</script> | ||
|
||
<template> | ||
<button @click="inc">{{ count }}</button> | ||
<Hello /> | ||
</template> |
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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import { mount } from '../../src' | ||
import Hello from '../components/Hello.vue' | ||
import ScriptSetup from '../components/ScriptSetup.vue' | ||
|
||
describe('sfc', () => { | ||
it('mounts an sfc via vue-test-transformer', () => { | ||
const wrapper = mount(Hello) | ||
expect(wrapper.find('#msg').text()).toBe('Hello world') | ||
}) | ||
|
||
// rfc: https://github.com/vuejs/rfcs/pull/228 | ||
it('works with <script setup> (as of Vue 3.0.3)', async () => { | ||
const wrapper = mount(ScriptSetup) | ||
expect(wrapper.findComponent(Hello).exists()).toBe(true) | ||
|
||
await wrapper.find('button').trigger('click') | ||
expect(wrapper.html()).toContain('1') | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -272,9 +272,9 @@ | |
integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw== | ||
|
||
"@babel/parser@^7.12.0": | ||
version "7.12.2" | ||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.2.tgz#9d2fcf24cafe85333ab0aff9f26b81bba356004d" | ||
integrity sha512-LMN+SqTiZEonUw4hQA0A3zG8DnN0E1F4K107LbDDUnC+0chML1rvWgsHloC9weB4RmZweE0uhFq0eGX7Nr/PBQ== | ||
version "7.12.7" | ||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056" | ||
integrity sha512-oWR02Ubp4xTLCAqPRiNIuMVgNO5Aif/xpXtabhzW2HWUD47XJsAB4Zd/Rg30+XeQA3juXigV7hlquOTmwqLiwg== | ||
|
||
"@babel/plugin-proposal-async-generator-functions@^7.8.3": | ||
version "7.8.3" | ||
|
@@ -804,7 +804,7 @@ | |
lodash "^4.17.13" | ||
to-fast-properties "^2.0.0" | ||
|
||
"@babel/types@^7.10.4", "@babel/types@^7.12.0", "@babel/types@^7.3.3": | ||
"@babel/types@^7.10.4", "@babel/types@^7.3.3": | ||
version "7.12.1" | ||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae" | ||
integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA== | ||
|
@@ -813,6 +813,15 @@ | |
lodash "^4.17.19" | ||
to-fast-properties "^2.0.0" | ||
|
||
"@babel/types@^7.12.0": | ||
version "7.12.7" | ||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.7.tgz#6039ff1e242640a29452c9ae572162ec9a8f5d13" | ||
integrity sha512-MNyI92qZq6jrQkXvtIiykvl4WtoRrVV9MPn+ZfsoEENjiWcBQ3ZSHrkxnJWgWtLX3XXqX5hrSQ+X69wkmesXuQ== | ||
dependencies: | ||
"@babel/helper-validator-identifier" "^7.10.4" | ||
lodash "^4.17.19" | ||
to-fast-properties "^2.0.0" | ||
|
||
"@bcoe/v8-coverage@^0.2.3": | ||
version "0.2.3" | ||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" | ||
|
@@ -1272,36 +1281,36 @@ | |
dependencies: | ||
"@types/yargs-parser" "*" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.2.tgz#7790b7a1fcbba5ace4d81a70ce59096fa5c95734" | ||
integrity sha512-GOlEMTlC/OdzBkKaKOniYErbkjoKxkBOmulxGmMR10I2JJX6TvXd/peaO/kla2xhpliV/M6Z4TLJp0yjAvRIAw== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.3.tgz#dbb4d5eb91f294038f0bed170a1c25f59f7dc74f" | ||
integrity sha512-iWlRT8RYLmz7zkg84pTOriNUzjH7XACWN++ImFkskWXWeev29IKi7p76T9jKDaMZoPiGcUZ0k9wayuASWVxOwg== | ||
dependencies: | ||
"@babel/parser" "^7.12.0" | ||
"@babel/types" "^7.12.0" | ||
"@vue/shared" "3.0.2" | ||
"@vue/shared" "3.0.3" | ||
estree-walker "^2.0.1" | ||
source-map "^0.6.1" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.2.tgz#1d40de04bcdf9aabb79fb6a802dd70a2f3c2992a" | ||
integrity sha512-jvaL4QF2yXBJVD+JLbM2YA3e5fNfflJnfQ+GtfYk46ENGsEetqbkZqcX7fO+RHdG8tZBo7LCNBvgD0QLr+V4sg== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.3.tgz#582ba30bc82da8409868bc1153ff0e0e2be617e5" | ||
integrity sha512-6GdUbDPjsc0MDZGAgpi4lox+d+aW9/brscwBOLOFfy9wcI9b6yLPmBbjdIsJq3pYdJWbdvACdJ77avBBdHEP8A== | ||
dependencies: | ||
"@vue/compiler-core" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/compiler-core" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
|
||
"@vue/compiler-sfc@^3.0.2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.2.tgz#22c70fed72c347a4d5fa2db2e80594b3193dce57" | ||
integrity sha512-viYjT5ehDSLM3v0jQ9hbTs4I5e/7lSlYsDOp7TQ1qcwHRvzoTQMTkFpY/Iae+LFKM124Ld17tBfXgfrZl9dt+g== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.3.tgz#7fad9d40e139dd717713c0db701e1eb776f8349f" | ||
integrity sha512-YocHSirye85kRVC4lU0+SE6uhrwGJzbhwkrqG4g6kmsAUopZ0qUjbICMlej5bYx2+AUz9yBIM7hpK8nIKFVFjg== | ||
dependencies: | ||
"@babel/parser" "^7.12.0" | ||
"@babel/types" "^7.12.0" | ||
"@vue/compiler-core" "3.0.2" | ||
"@vue/compiler-dom" "3.0.2" | ||
"@vue/compiler-ssr" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/compiler-core" "3.0.3" | ||
"@vue/compiler-dom" "3.0.3" | ||
"@vue/compiler-ssr" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
consolidate "^0.16.0" | ||
estree-walker "^2.0.1" | ||
hash-sum "^2.0.0" | ||
|
@@ -1313,42 +1322,42 @@ | |
postcss-selector-parser "^6.0.4" | ||
source-map "^0.6.1" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.2.tgz#73af4d274a79bfcc72a996a9b45f1072e7deaa26" | ||
integrity sha512-gOgK1lf+0bFl+kQj6TU0TU1jIDFlsPRlSBZaUUA16DGeeiJrFanhsMuIs/l9U0IBFr/VJcHgzYpTXqHp95luHw== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.3.tgz#7d9e5c1b8c71d69865ac6c48d2e6eb2eecb68501" | ||
integrity sha512-IjJMoHCiDk939Ix7Q5wrex59TVJr6JFQ95gf36f4G4UrVau0GGY/3HudnWT/6eyWJ7267+odqQs1uCZgDfL/Ww== | ||
dependencies: | ||
"@vue/compiler-dom" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/compiler-dom" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.2.tgz#42ed5af6025b494a5e69b05169fcddf04eebfe77" | ||
integrity sha512-GdRloNcBar4yqWGXOcba1t//j/WizwfthfPUYkjcIPHjYnA/vTEQYp0C9+ZjPdinv1WRK1BSMeN/xj31kQES4A== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.3.tgz#681ee01ceff9219bc4da6bbb7d9c97d452e44d1d" | ||
integrity sha512-t39Qmc42MX7wJtf8L6tHlu17eP9Rc5w4aRnxpLHNWoaRxddv/7FBhWqusJ2Bwkk8ixFHOQeejcLMt5G469WYJw== | ||
dependencies: | ||
"@vue/shared" "3.0.2" | ||
"@vue/shared" "3.0.3" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.2.tgz#d7ed462af1cb0bf9836668e4e6fab3f2f4b1bc00" | ||
integrity sha512-3m/jOs2xSipEFah9FgpEzvC9nERFonVGLN06+pf8iYPIy54Nlv7D2cyrk3Lhbjz4w3PbIrkxJnoTJYvJM7HDfA== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.3.tgz#edab3c9ad122cf8afd034b174cd20c073fbf950a" | ||
integrity sha512-Fd1JVnYI6at0W/2ERwJuTSq4S22gNt8bKEbICcvCAac7hJUZ1rylThlrhsvrgA+DVkWU01r0niNZQ4UddlNw7g== | ||
dependencies: | ||
"@vue/reactivity" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/reactivity" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.2.tgz#9d166d03225558025d3d80f5039b646e0051b71c" | ||
integrity sha512-vqC1KK1yWthTw1FKzajT0gYQaEqAq7bpeeXQC473nllGC5YHbJhNAJLSmrDun1tjXqGF0UNCWYljYm+++BJv6w== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.3.tgz#5e3e5e5418b9defcac988d2be0cf65596fa2cc03" | ||
integrity sha512-ytTvSlRaEYvLQUkkpruIBizWIwuIeHER0Ch/evO6kUaPLjZjX3NerVxA40cqJx8rRjb9keQso21U2Jcpk8GsTg== | ||
dependencies: | ||
"@vue/runtime-core" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/runtime-core" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
csstype "^2.6.8" | ||
|
||
"@vue/[email protected].2": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.2.tgz#419bd85a2ebdbd4f42963e98c5a1b103452176d9" | ||
integrity sha512-Zx869zlNoujFOclKIoYmkh8ES2RcS/+Jn546yOiPyZ+3+Ejivnr+fb8l+DdXUEFjo+iVDNR3KyLzg03aBFfZ4Q== | ||
"@vue/[email protected].3": | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.3.tgz#ef12ebff93a446df281e8a0fd765b5aea8e7745b" | ||
integrity sha512-yGgkF7u4W0Dmwri9XdeY50kOowN4UIX7aBQ///jbxx37itpzVjK7QzvD3ltQtPfWaJDGBfssGL0wpAgwX9OJpQ== | ||
|
||
abab@^2.0.0: | ||
version "2.0.5" | ||
|
@@ -6180,14 +6189,14 @@ vue-router@^4.0.0-rc.1: | |
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.0.0-rc.1.tgz#42f41315849163a1243886c9aa6d7c14f24fd003" | ||
integrity sha512-N3SSOIiRFo1/D6EkHGuahUSuyDvFhKizN5zVXkALX7wv0hYYndV49KwzRF5lKsAIt+OlDl7y+sNmwNewb7a4iw== | ||
|
||
vue@^3.0.2: | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.2.tgz#9d5b7b2983f35e64a34d13c7c9d6831239feca3c" | ||
integrity sha512-ciKFjutKRs+2Vbvgrist1oDd5wZQqtOel/K//ku54zLbf8tcTV+XbyAfanTHcTkML9CUj09vnC+y+5uaOz2/9g== | ||
[email protected].3: | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.3.tgz#ad94a475e6ebbf3904673b6a0ae46e47b957bd72" | ||
integrity sha512-BZG5meD5vLWdvfnRL5WqfDy+cnXO1X/SweModGUna78bdFPZW6+ZO1tU9p0acrskX3DKFcfSp2s4SZnMjABx6w== | ||
dependencies: | ||
"@vue/compiler-dom" "3.0.2" | ||
"@vue/runtime-dom" "3.0.2" | ||
"@vue/shared" "3.0.2" | ||
"@vue/compiler-dom" "3.0.3" | ||
"@vue/runtime-dom" "3.0.3" | ||
"@vue/shared" "3.0.3" | ||
|
||
vuex@^4.0.0-beta.4: | ||
version "4.0.0-beta.4" | ||
|