mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Fix attribute error with emit being remove, check ordered_rows is correct after sort
This commit is contained in:
@@ -1499,7 +1499,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
||||
meta = self.get_style_at(event.x, event.y).meta
|
||||
if meta:
|
||||
self.cursor_coordinate = Coordinate(meta["row"], meta["column"])
|
||||
self._emit_selected_message()
|
||||
self._post_selected_message()
|
||||
self._scroll_cursor_into_view(animate=True)
|
||||
event.stop()
|
||||
|
||||
|
||||
@@ -579,6 +579,10 @@ async def test_sort_coordinate_and_key_access():
|
||||
assert table.get_value_at(Coordinate(1, 0)) == 2
|
||||
assert table.get_value_at(Coordinate(2, 0)) == 3
|
||||
|
||||
assert table.ordered_rows[0].key == row_one
|
||||
assert table.ordered_rows[1].key == row_two
|
||||
assert table.ordered_rows[2].key == row_three
|
||||
|
||||
|
||||
async def test_sort_reverse_coordinate_and_key_access():
|
||||
"""Ensure that, after sorting, that coordinates and cell keys
|
||||
@@ -608,6 +612,10 @@ async def test_sort_reverse_coordinate_and_key_access():
|
||||
assert table.get_value_at(Coordinate(1, 0)) == 2
|
||||
assert table.get_value_at(Coordinate(2, 0)) == 1
|
||||
|
||||
assert table.ordered_rows[0].key == row_three
|
||||
assert table.ordered_rows[1].key == row_two
|
||||
assert table.ordered_rows[2].key == row_one
|
||||
|
||||
|
||||
def test_key_equals_equivalent_string():
|
||||
text = "Hello"
|
||||
|
||||
Reference in New Issue
Block a user