GithubHelp home page GithubHelp logo

Comments (5)

lmiller1990 avatar lmiller1990 commented on May 11, 2024
  • mixins: I went with the global one for now just to get something working. Is there a use case where you want to override a mixin on the per component level? I was thinking this more for the use case people want to test a component that would have a global mixin.

  • plugins: by passing them and writing them to the returns app, isn't this more or less the same as a localVue with a plugin?

  • provides: seems fine (not sure if you are asking a question or not)

  • data: yep, idea of the data mounting option to override the data - the current approach overrides all components, which could be a problem. This was the only thing I could find that worked. We should be able to pass an extra argument to that mixin that is the name of the component (or some other unique identifier, via a symbol or something) and do something like

if (getCurrentInstance() === SomeIdentifier) {
  // mixin the data to override component local stte
}

So far everything is more of a "get something working and go from there" than an ideal solution, but thanks for picking up on some of the potential problems. Any ideas to work around these?

from test-utils.

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

mixins
Current VTU mount api mixes passed properties with those on a component. That way you could mix in your own mixin into a Vue component. I guess you could use something like jest.mock to the same extend.

plugins
It is the same as localVue, correct. But I think globally applied ones, should be separated from the Vue component properties, like data and props.

provides
Was thinking out loud. Should be fine yeah.

data
What if we use that data mixin only on the mounted component?

from test-utils.

lmiller1990 avatar lmiller1990 commented on May 11, 2024

An alternative to localVue (not sure if such a concept will exist in Vue 3) could be something like:

const wrapper = mount(Foo, {
  globals: {
    plugins: [...], 
    mixins: [...]
  }
})

from test-utils.

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

Yeah, not a bad idea, I like it :)
We cant allow them to pass their own App Instance though, as it no longer makes sense.

from test-utils.

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

Closed in #31

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.