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

Added first() and last() functions to FindWrapper #59

Merged
merged 2 commits into from
May 16, 2018

Conversation

DzikowskiW
Copy link
Contributor

Resolves #58

Copy link
Collaborator

@gnarf gnarf left a comment

Choose a reason for hiding this comment

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

Pretty much 👍 would land as is, but I got a little nit-picky about the test... Care to appease me here?

const context = func(<div><div class="first" /><div class="last" /></div>);
expect(() => context.last()).not.toThrow();
expect(() => context.find('span').last()).toThrow();
expect(context.find('div').last()[0]).toEqual(<div class="last" />);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you maybe add one more test for these that asserts the .length === 1?

const found = context.find('div').last();
expect(found).toHaveLength(1);
expect(found[0]).toEqual(<div class="last" />);

@gnarf gnarf merged commit 1a92bad into mzgoddard:master May 16, 2018
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.

None yet

2 participants