springload / draftail

📝🍸 A configurable rich text editor built with Draft.js
https://www.draftail.org/
MIT License
613 stars 64 forks source link

Pass aria properties through - add RTL test example #438

Closed dwjohnston closed 2 years ago

dwjohnston commented 3 years ago

This PR allows and demonstrates the use of React Testing Library with Draftail.

It passes through aria properties so RTL style queries can be used.

https://github.com/facebook/draft-js/issues/2833

Thanks for contributing to Draftail!

thibaudcolas commented 3 years ago

Hey @dwjohnston, thank you for proposing this. It feels a bit odd to me to change the editor’s API to accommodate any particular testing tool, but I’d definitely want testing with React Testing Library to be possible, so I’ll have a look.

dwjohnston commented 3 years ago

@thibaudcolas I've since removed the onMount stuff - so basically this PR is passing through the aria labels, and adds RTL and a demo test.

dwjohnston commented 3 years ago

@thibaudcolas I'm unable to make sense of the errors in the CI. Are you able to walk this through for me? We are otherwise maintaining a fork just to get those aria properties Note I have removed the pre-publish script, it was erroring locally for me building storybook, you probably want to put that back in.

thibaudcolas commented 2 years ago

Thank you @dwjohnston! I’m currently going through a lot of changes to the library, will pick up the remaining test failures later.