Optional
mapper?: ((targetElement) => HTMLElement)element that found by query and parameters
element that will be a result of calling the method of accessor
Example for Radio
from antd@5.10.1
const render = create(Component, defaultProps, {
queries: {
radio: {
query: AccessorQueryType.Text,
parameters: ["Radio"],
mapper: (radioLabel) => {
const wrapper = radioLabel.closest(".ant-radio-wrapper");
if (!wrapper) {
throw new Error("radio wrapper is not found");
}
const input = wrapper.querySelector("input");
if (!input) {
throw new Error("radio input is not found");
}
return input as HTMLElement;
},
},
},
});
const engine = render({});
const radioInput = page.accessors.radio.get();
Optional
parent?: AccessorParamsTypeAccessor of the parent element, can be used for same elements, e.g. lists of snippets, rows of tables
Generated using TypeDoc
Function for get needed element by target element. For example, get input by label in cluttered layout