Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test-utils): add 'overview' function #1491

Merged
merged 6 commits into from
Apr 8, 2020

Conversation

SergiCL
Copy link
Contributor

@SergiCL SergiCL commented Mar 29, 2020

close #1461

What kind of change does this PR introduce? (check at least one)

  • Feature

Does this PR introduce a breaking change? (check one)

  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
The main objective of this feature is "To give an overview of the state of the wrapper at the time the function is executed"

Example execution:

wraper.overview()

// Output
Wrapper (Visible):

Html:
    <div class="test">
      <p>My name is Tess Ting</p>
    </div>

Data: {
    firstName: Tess,
    lastName: Ting
}

Computed: {
    fullName: Tess Ting'
}

Emitted: {',
    foo: [',
        0: [ hello, world ],
        1: [ bye, world ]'
    ],
    bar: [
        0: [ hey ]'
    ]
}

More info

@lmiller1990
Copy link
Member

Holy moly what a PR! I like how in depth your tests go.

Please give me some time to review this.

@SergiCL
Copy link
Contributor Author

SergiCL commented Apr 1, 2020

Holy moly what a PR! I like how in depth your tests go.

Please give me some time to review this.

Thank you. No problem, take as much time as you need.

@lmiller1990 lmiller1990 mentioned this pull request Apr 3, 2020
13 tasks
Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments!

test/specs/wrapper/overview.spec.js Outdated Show resolved Hide resolved
test/specs/wrapper/overview.spec.js Show resolved Hide resolved
test/specs/wrapper/overview.spec.js Show resolved Hide resolved
@SergiCL SergiCL requested a review from lmiller1990 April 7, 2020 19:36
Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a solid PR.

this is the last API we will be adding before v1! This will go out with v1, should be in a week or two.

@julisch94
Copy link

Hey folks, I'm unsure if this is the right place to ask. I would like such an overview() function but I can't find it anywhere even though I can see it was added by you.

It's still in the code:
https://github.com/vuejs/vue-test-utils/blob/dev/packages/test-utils/src/wrapper.js#L450-L455C21
(even though deprecated, why?)

There's also nothing about it in the docs:
https://v1.test-utils.vuejs.org/api/wrapper

So how can I print the DOM tree of a component with vue test utils like I can do with react testing library using screen.debug()?

Anyone can help me understand this a bit better?

@lmiller1990
Copy link
Member

lmiller1990 commented Sep 24, 2023

You can print the HTML with wrapper.html() https://test-utils.vuejs.org/api/#html

I am not sure about overview(), I completely forgot about it. I think the confusion is the overview() function was added to v1 of this lib (which works with Vue 2) but you might be on v2 of this lib (which works with Vue 3).

@julisch94
Copy link

@lmiller1990 oh right! Thanks! I was looking at the v1 of the docs. Didn't notice that Google sent me to v1 instead of v2. And also thanks for pointing me to wrapper.html(). It served my purpose. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a debuger function to check wrapper content
3 participants