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

Add hasChild method to assert that child element exists #1580

Open
jelhan opened this issue May 23, 2022 · 0 comments
Open

Add hasChild method to assert that child element exists #1580

jelhan opened this issue May 23, 2022 · 0 comments

Comments

@jelhan
Copy link
Contributor

jelhan commented May 23, 2022

A hasChild method would be helpful to assert that a child element exists.

Currently I find myself writing something like this from time to time:

assert
  .dom('foo')
  .hasText('...', 'renders text');
assert
  .dom('foo .bar')
  .exists('renders expected child element');

For readability it would be great if I could do this instead:

assert
  .dom('foo')
  .hasText('...', 'renders text')
  .hasChild('.bar', 'renders expected child element');

This may be addressed by #1579 as well. But I think hasChild would be more handy for simple cases, in which you only want to assert that a child element exists.

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

No branches or pull requests

1 participant