File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 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/).
2222- Static and Label now accept Content objects, satisfying type checkers https://github.com/Textualize/textual/pull/5618
2323- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
2424- 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
2526- Fixed additional spaces after text-wrapping https://github.com/Textualize/textual/pull/5657
2627- Added missing ` scroll_end ` parameter to the ` Log.write_line ` method https://github.com/Textualize/textual/pull/5672
2728- 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:
477477
478478 """
479479 value = self .value
480- assert not isinstance (value , NoSelection )
480+ if isinstance (value , NoSelection ):
481+ return None
481482 return value
482483
483484 def _setup_variables_for_options (
Original file line number Diff line number Diff line change @@ -63,3 +63,13 @@ def compose(self):
6363 assert not select .is_blank ()
6464 with pytest .raises (InvalidSelectValueError ):
6565 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