Merge branch 'main' into auto-focus-improv

This commit is contained in:
Rodrigo Girão Serrão
2023-05-16 11:40:13 +01:00
committed by GitHub
4 changed files with 26 additions and 1 deletions

View File

@@ -207,3 +207,17 @@ async def test_auto_focus_skips_non_focusable_widgets():
async with app.run_test():
assert app.focused is not None
assert isinstance(app.focused, Button)
async def test_dismiss_non_top_screen():
class MyApp(App[None]):
async def key_p(self) -> None:
self.bottom, top = Screen(), Screen()
await self.push_screen(self.bottom)
await self.push_screen(top)
app = MyApp()
async with app.run_test() as pilot:
await pilot.press("p")
with pytest.raises(ScreenStackError):
app.bottom.dismiss()