Giter VIP home page Giter VIP logo

Comments (5)

lmiller1990 avatar lmiller1990 commented on May 16, 2024

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.

dobromir-hristov avatar dobromir-hristov commented on May 16, 2024

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.

dobromir-hristov avatar dobromir-hristov commented on May 16, 2024

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.

lmiller1990 avatar lmiller1990 commented on May 16, 2024

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.

dobromir-hristov avatar dobromir-hristov commented on May 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.