testing-library / vue-testing-library

🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
http://testing-library.com/vue
MIT License
1.08k stars 109 forks source link

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

Closed sunecosuri closed 2 years ago

sunecosuri commented 2 years ago

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?

afontcu commented 2 years ago

Hi! The main reason is that HTMLElement does not include SVG elements: https://github.com/testing-library/react-testing-library/pull/833

thank you for the question!

SCasarotto commented 2 years ago

I went looking for this exact same thing. I noticed in the react-testing-library there was some sort of solution to this. https://github.com/testing-library/react-testing-library/pull/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.