-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1065 When we are testing a component with a render function returned by the setup, then its proxy will be empty. The behavior difference can be seen in vue-next [here](https://github.com/vuejs/vue-next/blob/d19cfc0503dddbded5e599bef0965aba3d25ca28/packages/runtime-core/src/component.ts#L674). In that case, `wrapper.vm` will be empty if we return `vm.$.proxy`. To handle it, we return `vm` directly for such components, allowing at least what is exposed publicly to be available on `wrapper.vm`.
- Loading branch information
Showing
3 changed files
with
36 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script lang="ts"> | ||
import { defineComponent, h, ref } from 'vue' | ||
export default defineComponent({ | ||
name: 'Hello', | ||
setup(props, { expose }) { | ||
const other = ref('other') | ||
const msg = ref('Hello world'); | ||
expose({ other }) | ||
return () => [h('div', msg.value), h('div', other.value)] | ||
} | ||
}) | ||
</script> |
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