charmbracelet / bubbles

TUI components for Bubble Tea 🫧
MIT License
5.35k stars 252 forks source link

Add TextInput Tests #500

Closed KevM closed 4 months ago

KevM commented 5 months ago

When suggestions are not yet set CurrentSuggestion() will panic. This change fixes that with a guard and returns an empty string when there is no current suggestion.

I added a test to ensure the fix works.

maaslalani commented 4 months ago

@KevM I believe this is fixed now as there is a merge conflict with both performing a len check. Can you confirm if this is needed / still valid?

KevM commented 4 months ago

I fixed the merge conflict. I like your solution better. You can land this PR is you'd like to include the tests I wrote otherwise feel free to close it. Thank You!

maaslalani commented 4 months ago

Thanks! Tests are always great, I will merge this.