charmbracelet / bubbles

TUI components for Bubble Tea 🫧
MIT License
5.52k stars 265 forks source link

test(textarea): Improve textarea tests #490

Closed mikelorant closed 7 months ago

mikelorant commented 8 months ago

Improve textarea tests to check the cursor location. This is the displayed location and not the line row and column (which does not take into account soft wrapping).

As part of this improvement, a number of existing tests were merged into the view test tables as it was unnecessary duplication of code having them separated.

mikelorant commented 8 months ago

@maaslalani Converting the older tests into the test tables.

mikelorant commented 7 months ago

My intention after this gets merged is to also add checks for the value so we can confirm what is provided back to the user. What we render is not the same as what the value might be due to wrapping and scrolling.

mikelorant commented 7 months ago

@meowgorithm @maaslalani This one is also ready to be review. Just improves the tests, no changes to any other functionality.

maaslalani commented 7 months ago

Thanks for this one @mikelorant, really appreciate the well written tests!

mikelorant commented 7 months ago

No problem. I'll expand the tests to check a few more things and we should be able to convert nearly every other test into a single test table.