Giter VIP home page Giter VIP logo

Comments (5)

lmiller1990 avatar lmiller1990 commented on May 16, 2024 1

@dobromir-hristov is looking into this. The idea is looking to be to provide this as a config users can enable, so you can have the behavior you like. eg config.shallowMount = { renderSlots: true } or something, since the default is stubbing them.

from test-utils.

TheJaredWilcurt avatar TheJaredWilcurt commented on May 16, 2024 1

Another use case for this to shallow mount a view/component that contains a 3rd-party component. Where you don't want to load the complexity of that 3rd party component, but you do want to test your code being passed into the slot. It can make snapshots more useful and less cluttered.

from test-utils.

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

So what does does, is render all the slots of a component? For simpler cases (pure unit tests) I guess that would be OK, when you dont rely on scopedSlots or slots rendering conditionally.

Even though it makes sense, I think this will either have to stay in user land, or will be exported as a separate utility, similar to what you have now.

Current implementation is: stubbed components are just plain elements tags, that do not render any of their slots.

from test-utils.

lmiller1990 avatar lmiller1990 commented on May 16, 2024

It's not documented anywhere because it's not intended behavior, but rather a side effect of poorly implemented shallow, which should be stubbing all children (and their slots).

You are welcome to play with the transformVNodeArgs function used here - it's built into core with stubbing in mind. Maybe we can expose some kind of plugin for this. What is supposed to happen? Does the child's lifecycle hooks get called? What if it has more components with more slots? If we are attempting to provide this feature (core or plugin) we should define exactly what it should (and should not) do.

I agree that this probably doesn't really belong as a core behavior; no other testing frameworks do this, and they get by fine (including Enzyme, which has a shallow function).

from test-utils.

lmiller1990 avatar lmiller1990 commented on May 16, 2024

Let's chat about this in here #108

This could be a helper. I don't mind having this feature.

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.