Comments (5)
find
/findAll
: should be business as usual, I think. Eg:
<template>
<div id="foo" />
<div id="bar" />
</template>
find
and findAll
should be able to find all the children. What does $el
return? Is there some way to access all the children (maybe vm.children
)?
I think we drop classes
on components, as well as attrs and text. Components don't have classes, DOM elements inside of components do.
from test-utils.
find
and findAll
would then have to search from the root element
, not the component you have an instance reference to. So we cant expect chain find
on VueWrapper instances.
$el
returns a comment tag if no single root component exists.
from test-utils.
Did some more digging:
vm
is a proxy and exposes a few properties, one of which el
which points to vnode.el
, but as I said, it points to an empty comment tag when working with fragments, as it points to the first available element.
I could not find a way to fetch all the children from the ComponentPublicInstance we have access to. See https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/componentProxy.ts#L78
from test-utils.
Seems like you found something since making this comment - are we able to have find work on components with multiple root nodes now?
from test-utils.
Yes, added a test for it
https://github.com/vuejs/vue-test-utils-next/pull/25/files#diff-7dcc2cb7981ded4a1daa7e62feea0c29R17
from test-utils.
Related Issues (20)
- Feature request: update teleport testing documentation HOT 1
- Bug: snapshots are mismatching on different platforms HOT 8
- Bug: wrapper.findComponent no longer working after upgrading to 2.4.2 HOT 6
- Bug: clicking button type submit doesn't trigger submit event HOT 2
- Bug: can't pass a prop to a stubbed custom element using a `.prop` modifier HOT 1
- chore(docs): translate the documentation to portuguese
- Bug: TypeError: $setup.mergeProps is not a function HOT 5
- Feature request: mount should accept a partial that describes local properties on component HOT 1
- Bug: Circular references in props cause "Maximum call stack size exceeded" since v2.4.5 HOT 7
- Bug: findComponent doesn't find anything when using @vue/compat HOT 4
- DOMWrapper giving different return than createWrapper. HOT 6
- .setValue to work on `[contenteditable=true]` elements HOT 2
- Bug: "to" is missing from the attribute in RouterLinkStub HOT 1
- Bug: isDeepRef causes "RangeError: Maximum call stack size exceeded" HOT 1
- Bug: Scoped slots always undefined when shallow mounting and `renderStubDefaultSlot` is enabled HOT 1
- Docs: afterEach in teleport section causes issues on happy-dom HOT 1
- dev: use eslint v9
- Bug: Event declared via $attrs in mount not establishing prop prefixed with `on` HOT 3
- Using useSlots will report a warning HOT 1
- Bug: Stubs broken in `[email protected]` HOT 4
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 test-utils.