react-get-element
To get the HTML DOM Element in the path string from 'React Component'.
- Like jquery|.get()
- In easy-to-understand
- It can be obtained in the path, such as the
div.span.p
andtable:class1.tbody
- Recommended be used in React Component of test(bdd)
Installation
npm install react-get-element --save ;
Usage
- The path in the tag, id or class name
- Symbols
- Hierarchy with a
.
#
to id:
to class name
- Hierarchy with a
Tags specified
Component { return <div id="root"> <div id="main"> <div className="class1"> <span>span-text</span> </div> <p className="class2">test</p> <p>p-text1</p> <p>p-text2</p> </div> </div> ; } const component = ReactTestUtils;const elements = ReactTestUtils; ;// => div element ;// => p element ;// => p element ;// => span element ;// => undefined
Features
- It returns an array when there is more than one
- If there is something..
Development
- Check in the
npm run
at the project root directory.
npm installnpm run build npm run testnpm run lint
LICENSE
MIT