Functions for locating particular a DOM node or component from the list of matches found by Scope#find.
Select a component or a DOM node at a specified index from the list of matches.
// find the fourth Button under component
drill(component).find(Button, m.at(3))
Create a matcher function that tests a DOM node for either having a certain attribute at all, or for having that attribute with a specific value.
name | String The attribute name. |
value | * The attribute value. When blank, only the attribute existence will be checked for. |
Using with the drill API
const { m, drill } = require('react-drill');
drill(myComponent)
.find(Button, m.hasAttribute('disabled', false))
.click()
;
Create a matcher function that tests a DOM node for containing a certain CSS class.
className | String The CSS class you are expecting the Node to contain. |
Using with the drill API
const { m, drill } = require('react-drill');
drill(myComponent)
.find(Button, m.hasClass('btn--danger'))
.click()
;
Select a component that has a prop matching the specified value.
Create a matcher function that tests a DOM node for having a certain property with a specific value.
property | String The property name. |
value | String The value name. |
Using with the drill API
const { m, drill } = require('react-drill');
drill(myComponent)
.find('input', m.hasProperty('value', 'foo'))
.click()
;
A matcher for the textContent of a Node.
text | String The text, or a part of it, you are expecting. |
Using with the drill API
const { m, drill } = require('react-drill');
drill(myComponent)
.find(Button, m.hasText('Remove User'))
.click()
;