Skip to content

Fix chain commands with previous subject different of document, element or window #115

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

Merged
merged 2 commits into from
Feb 3, 2020
Merged

Conversation

leosuncin
Copy link
Contributor

@leosuncin leosuncin commented Feb 2, 2020

What:

Allow commands to be chained when previous command does not returns document, element or window

Why:

Fix #114

How:

Remove document, element or window from prevSubject in createCommand

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged

This allows to commands to be chained with a previous command
that not returns a document, element or window

FIX #114
@leosuncin leosuncin changed the title <!-- Thanks for your interest in the project. Bugs filed and PRs submitted are appreciated! Fix #114 Feb 3, 2020
@leosuncin leosuncin changed the title Fix #114 Fix chain commands with previous subject different of document, element or window Feb 3, 2020

it('should chain findBy* with subject different of document, element or window', () => {
cy.wrap(true)
.should('be.true')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good test to verify the functionality 👍

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Thank you for the fast fix @leosuncin!

@kentcdodds kentcdodds merged commit 93e6d5c into testing-library:master Feb 3, 2020
@kentcdodds
Copy link
Member

@all-contributors please add @leosuncin for bugs, code, and tests

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @leosuncin! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

CypressError: cy.findByText() failed because it requires the subject be a global 'document' object.
3 participants