Be 100% sure all removals take place

This commit is contained in:
Dave Pearson
2022-11-10 20:41:11 +00:00
parent d3e7f5ad99
commit 32e6f71856

View File

@@ -122,7 +122,9 @@ async def test_widget_remove_order():
await pilot.app.mount(
Removable(Removable(Removable(id="grandchild"), id="child"), id="parent")
)
assert len(pilot.app.screen.walk_children(with_self=False)) == 3
await pilot.app.screen.children[0].remove()
assert len(pilot.app.screen.walk_children(with_self=False)) == 0
assert removals == ["grandchild", "child", "parent"]
async def test_query_remove_order():
@@ -138,5 +140,7 @@ async def test_query_remove_order():
await pilot.app.mount(
Removable(Removable(Removable(id="grandchild"), id="child"), id="parent")
)
assert len(pilot.app.screen.walk_children(with_self=False)) == 3
await pilot.app.query(Removable).remove()
assert len(pilot.app.screen.walk_children(with_self=False)) == 0
assert removals == ["grandchild", "child", "parent"]