Comments (4)
I think it makes sense to make props
work for both contexts. And it's a nicer API then using propsData
.
Ideally it makes no difference what kind of Component gets mounted as all params will be passed in the same way. Options passed along that don't count for functional components will then be ignored by Vue instance anyway.
from vue-test-utils.
Closed with eda39df
from vue-test-utils.
Agree to 100%, feels natural and allows for customization or extending in the future.
Would you internally turn it to propsData
?
from vue-test-utils.
The way I got this working in avoriaz is to mount a component with a render functional that returns the functional component and passes it the context object -
https://github.com/eddyerburgh/avoriaz/blob/master/src/mount.js#L33
I imagine there are problems with doing it like this, but I wanted to get something out there as a canary test.
Maybe we should also allow users to pass props to mount
with props
instead of propsData
, as it's cleaner
from vue-test-utils.
Related Issues (20)
- testing a child component inside a parent slot
- Composables are not being mocked in Vitest HOT 10
- When setProps() is called on a wrapper which renders a slot, the slot's content element gets destroyed
- `RouterLink.useLink` is missing when using `RouterLinkStub`. HOT 3
- Test child component, which is the root element HOT 3
- Computed value does not update when data updates
- isVisible() not seeing display: none using vitest with jsdom HOT 4
- Testing component with onBeforeRouteLeave hook raising "No active route record was found" warning HOT 1
- vue2 引入 element2. 页面存在table 表格 jest 测试报错 HOT 1
- *.svg?inline issues
- Errors in `setup()` are silent if `render()` throws an error HOT 6
- Check style changes on hover HOT 1
- setData on writable computed property does not seem to work as it does in VTU.1
- classes documentation
- Support Vue 2.7.16 HOT 2
- Vue test utils not updating template when testing composables
- TypeError: $setup.mergeProps is not a function
- Data property is already defined in Props. HOT 1
- Unable to use vitest spy within vue/nuxt 3 component methods.
- `findComponent` doesn't find anything when using `@vue/compat` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-test-utils.