The rendered element data, which is the string content in the case of a base element
the parent element of the rendered element
The props object of the rendered element
The type of the rendered element
Find an element by its className
An array of ElementExplorer instances that match the className
const el = shallow(
<div><button className="test-button">Test Button</button></div>
);
const explorer = el.instance;
const buttons = explorer.findByClassName('test-button');
Find an element by its data-testid attribute
An array of ElementExplorer instances that match the testId
const el = shallow(
<div data-testid="parent"><div data-testid="child"></div></div>
);
const explorer = el.instance;
const childElements = explorer.findByTestId("child");
Find an element by its type
An array of ElementExplorer instances that match the type
const el = shallow(
<div><button>Test Button</button></div>
);
const explorer = el.instance;
const buttons = explorer.findByType('button');
Check if the element matches the provided element
The element to compare
A boolean indicating if the element matches the provided element
const el = shallow(
<div><button>Test Button</button></div>
);
const explorer = el.instance;
const button = explorer.findByType('button')[0];
const matches = button.matches(shallow(<button>Test Button</button>));
expect(matches).toBe(true);
Generated using TypeDoc
The child elements of the rendered element