Drill into a rendered component and start kicking. This is the main export of the library.
import { drill } from 'react-drill'
import Menu from './Menu'
const component = ReactDOM.render(Menu, document.createElement('div'))
drill(component)
.find('button', m.hasText('Logout'))
.click()Add a new action that will be available on the scope API. Refer to this example for implementing a custom action.
name | StringThe name by which we should expose the action on the Scope API. |
action | FunctionThe actual action implementation. |
Advanced for use by addons to override the default DOM operations which are normally handled by jQuery. See DOM.
Add a new API for Scope. This is useful for extending the scope with functionality other than actions like custom warp routines.
The teleporting example shows this in practice.
name | StringThe name to use for the API. |
fn | () -> ScopeThe function MUST return a scope (new or itself.) |
Register a new matcher that can be accessed through the m
exported symbol of the package. Refer to this example for implementing one.
name | StringThe name to register the matcher to. |
fn | FunctionThe matcher function. |
Override an existing selector to use a different driver than jQuery (e.g. cheerio).
name | StringThe name of the selector (like |
fn | FunctionThe selector function. |
Actions
DEPRECATED
Use of these APIs without a Scope is discouraged and support for it will be
dropped in the future.
A stand-alone version of the DOM helpers to be used without the drilling API.
ScopeSelectors
DEPRECATED
Use of these APIs without a Scope is discouraged and support for it will be
dropped in the future.
A stand-alone version of the DOM selectors to be used without the drilling API.
drillA convenience shortcut to the drill function when you are using ES6 destructuring.
For example, the following all work and are equivalent:
// [1]
import { drill, m } from 'react-drill'
// [2]
import drill, { m } from 'react-drill'
// [3]
const { drill, m } = require('react-drill')
// [4]
const drill = require('react-drill')
const { m } = drill