Skip to content

feature: implement toContainElement Jest matcher #1486

Closed
@mdjastrzebski

Description

@mdjastrzebski

Describe the Feature

toContainElement is a Jest DOM matcher asserting that given element contains other passed element.

We also have toContainElement already implemented in Jest Native. So migrating it to current repo, updating code to use RNTL helpers and reviewing TS types + tests quality should be the scope for the task.

Possible Implementations

Proposed API:

export function toContainElement(
  this: jest.MatcherContext,
  container: ReactTestInstance,
  element: ReactTestInstance | null,
) {

The matcher should:

  1. Validate that it is invoked on a host element
  2. Check if given element contains the passed element

Each matcher should have a fairly comprehensive test suite.

Related Issues

#1454

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions