Giter Club home page Giter Club logo

Comments (3)

callumacrae avatar callumacrae commented on June 26, 2024

That looks really nice! I didn't even think of doing that, because I rarely use events, but this will definitely be useful.

I've invited you to be a collaborator on this repo - thank you for your contributions.

from vue-test.

asselin avatar asselin commented on June 26, 2024

Thanks for adding me as a collaborator!

I just created PR #8 for this feature. It's pretty straightforward, but after posting above, I got to thinking about whether it's a good idea to keep adding parameters to mount().

In PR #7 , I put together an example of an API that takes a hash instead, so usage looks like this:

it('should ...', () => {
    const HelloComponent = mount(Hello, {
      props: {
        prop1: 'foo',
        prop2: 7
      },
      slots: {
        slot1: '<div></div>'
      },
      events: {
        event1: someSpyProbably
      }
    };
  });

PR #7 shouldn't be merged as-is, it's for exploring this option.

Some notes:

  • This requires Vue 2 (see PR #9)
  • Since mount() already takes a hash as parm 2, if we name the new API mount, it would be a breaking change. I think that would be OK if we bump the version up to 2.x

What are your thoughts?

from vue-test.

callumacrae avatar callumacrae commented on June 26, 2024

I like the look of that, wonder if it's possible to make it backwards compatible anyway. Let's discuss it on that PR.

from vue-test.

Related Issues (6)

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.