File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
22
22
- Static and Label now accept Content objects, satisfying type checkers https://github.com/Textualize/textual/pull/5618
23
23
- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
24
24
- Fixed crash on clicking line API border https://github.com/Textualize/textual/pull/5641
25
+ - Fixed Select.selection now correctly returns None if Select.BLANK is selected instead of an AssertionError
25
26
- Fixed additional spaces after text-wrapping https://github.com/Textualize/textual/pull/5657
26
27
- Added missing `scroll_end` parameter to the `Log.write_line` method https://github.com/Textualize/textual/pull/5672
27
28
- Restored support for blink https://github.com/Textualize/textual/pull/5675
Original file line number Diff line number Diff line change @@ -477,7 +477,8 @@ def selection(self) -> SelectType | None:
477
477
478
478
"""
479
479
value = self.value
480
- assert not isinstance(value, NoSelection)
480
+ if isinstance(value, NoSelection):
481
+ return None
481
482
return value
482
483
483
484
def _setup_variables_for_options(
Original file line number Diff line number Diff line change @@ -63,3 +63,13 @@ def compose(self):
63
63
assert not select.is_blank()
64
64
with pytest.raises(InvalidSelectValueError):
65
65
select.clear()
66
+
67
+ async def test_selection_is_none_with_blank():
68
+ class SelectApp(App[None]):
69
+ def compose(self):
70
+ yield Select(SELECT_OPTIONS)
71
+
72
+ app = SelectApp()
73
+ async with app.run_test():
74
+ select = app.query_one(Select)
75
+ assert select.selection is None
You can’t perform that action at this time.
0 commit comments