SolidOS / solid-ui

User Interface widgets and utilities for Solid
https://solidos.github.io/solid-ui/dist/solid-ui.js
MIT License
148 stars 41 forks source link

add a test for text button; set textContent instead of innerText #386

Closed angelo-v closed 3 years ago

michielbdejong commented 3 years ago

I found https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext about this. Can you explain why we should change this?

angelo-v commented 3 years ago

I found https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext about this. Can you explain why we should change this?

The main cause I stumbled upon this is, that testing-library was not able to find the button by text, so I tried to figure out what is wrong with the text.

By setting textContent we get a real text node into the dom like <button>text</button> while by setting innerText the dom only contains <button />. If you revert back to innerText you can see the test I added fail. Also I found that textContent is standard, while innerText is non-standard introduced by IE.