This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns node(s) for the given string attribute value of `data-test-id` | |
* @function findByTestAttribute | |
* | |
* @name | |
* @param {ShallowWrapper} wrapper - ShallowMounted Enzyme wrapper | |
* @param {string} attributeValue - value of data-test-id attribute as string | |
* for searching the nodes | |
* @returns {ShallowWrapper} | |
*/ | |
export function findByTestAttribute(wrapper, attributeValue) { | |
if (!wrapper) { | |
return null; | |
} | |
return wrapper.find(`[data-test-id="${attributeValue}"]`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment