testing-library/vue-testing-library

Is there a reason why the return type of render is not HTMLElement?

sunecosuri opened this issue · 2 comments

The following lines.
https://github.com/testing-library/vue-testing-library/blob/main/types/index.d.ts#L21-L22

I thought it would be more convenient to same as arguments like findBy~~~ in query the HTMLElement type.
https://github.com/testing-library/dom-testing-library/blob/main/types/queries.d.ts#L63

Is there any reason?

Hi! The main reason is that HTMLElement does not include SVG elements: testing-library/react-testing-library#833

thank you for the question!

I went looking for this exact same thing. I noticed in the react-testing-library there was some sort of solution to this. testing-library/react-testing-library#868 Is there a reason not to follow suite here in vue-testing-library?

The other reason I feel this is reasonable is that all the query functions returned from render assume they received an HTMLElement.