Im wondering if putting new class name into html component only for readability and tests is ok. Let's say we have this situation:
class ComponentOne extends React.Component {
render(){
<div>
<div>
<div className="lower">
{sometext}
</div>
</div>
</div>
}
}
This classes are here only for better readability in browser and for better testing this component. Like this :
import { render } from '@testing-library/react'
it("Testing ComponentOne", ()=>{
const { container } = render(<Component/>)
const element = container.querySelector(".lower") // cleaner element searching
// testing element's text here
})
Is it a bad idea to using "empty" class in React only for readability/debugging/testing ? What is the best way to find elements while testing ?