Setter for TextArea load_text#3545
Conversation
|
Thoughts on tests / doc changes? 🤔 |
TomJGooding
left a comment
There was a problem hiding this comment.
I'm not a maintainer of Textual, but your code is missing type annotations and I've suggested tweaks to the docstring.
Do you think you could also add a simple test?
|
Thanks @TomJGooding, I wasn't sure about the argument doc string for a setter, but I guess there's no harm. And r.e. tests it seems needlessly duplicitous when we already have |
|
Sorry you might be right with this only being a setter. I think I was just on auto-pilot (and my change upset black). I will mind my own business and leave this for the maintainers! |
|
A simple test is still valuable as a guard against future regressions - it's a simple setter for now but could be modified in the future, so we want to capture it's expected behaviour. Just something like this would suffice: new_text = "hello\nworld\n"
text_area.text = new_text
assert text_area.text == new_text |
|
I wrote this test here for it, but I think your fork is locked as I can't push to this PR: async def test_text_setter():
app = TextAreaApp()
async with app.run_test():
text_area = app.query_one(TextArea)
new_text = "hello\nworld\n"
text_area.text = new_text
assert text_area.text == new_textAlso, if you could add a CHANGELOG.md entry too when you get a moment, that'd be great. |
As discussed #3525 (reply in thread)
Please review the following checklist.