Yeah, its clear, thank you bro
"And I hate the fact that I cant find a comp by id or name hehe"
I don't know if you already figured out how to do it, but I actually can by doing, for example:
const { container } = render(Component); expect(container.querySelector("#myid")).not.toBeNull();
You can create your custom selectors like this:
import { queryByAttribute, render } from '@testing-library/react'; const getByName = queryByAttribute.bind(null, 'name'); it('should...', () => { const { container } = render(<Component />); expect(getByName(container, 'the-name').toEqual(...) })
I have some custom selectors created in a utils file (name, type, id...).
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah, its clear, thank you bro
"And I hate the fact that I cant find a comp by id or name hehe"
I don't know if you already figured out how to do it, but I actually can by doing, for example:
const { container } = render(Component);
expect(container.querySelector("#myid")).not.toBeNull();
You can create your custom selectors like this:
I have some custom selectors created in a utils file (name, type, id...).