mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Datatable remove row (#2253)
* Checking in remove_row progress * Ensuring structures updated correctly when row deleted * Clamping index * Failed attempt * Removing rows * Update a type hint in DataTable * Remove some code that wasnt required * Use index syntax instead of get * Add DataTable remove row test * Snapshot tests for removing rows * Add a docstring for DataTable.remove_row method * Update changelog regarding DataTable.remove_row * Add check_idle call to remove_row
This commit is contained in:
@@ -289,6 +289,19 @@ async def test_add_columns_user_defined_keys():
|
||||
assert key == key
|
||||
|
||||
|
||||
async def test_remove_row():
|
||||
app = DataTableApp()
|
||||
async with app.run_test():
|
||||
table = app.query_one(DataTable)
|
||||
table.add_columns("A", "B")
|
||||
for row in ROWS:
|
||||
table.add_row(row, key=row[0])
|
||||
|
||||
assert len(table.rows) == 3
|
||||
table.remove_row(ROWS[0][0])
|
||||
assert len(table.rows) == 2
|
||||
|
||||
|
||||
async def test_clear():
|
||||
app = DataTableApp()
|
||||
async with app.run_test():
|
||||
|
||||
Reference in New Issue
Block a user