Skip to content

Add hasChild method to assert that child element exists #1580

@jelhan

Description

@jelhan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions