11from textual .app import App
22
3+
34class OnLoadDarkSwitch (App [None ]):
45 """App for testing toggling dark mode in on_load."""
56
67 def on_load (self ) -> None :
78 self .dark = not self .dark
89
10+
911async def test_toggle_dark_on_load () -> None :
1012 """It should be possible to toggle dark mode in on_load."""
1113 async with OnLoadDarkSwitch ().run_test () as pilot :
1214 assert not pilot .app .dark
1315
16+
1417class OnMountDarkSwitch (App [None ]):
1518 """App for testing toggling dark mode in on_mount."""
1619
1720 def on_mount (self ) -> None :
1821 self .dark = not self .dark
1922
23+
2024async def test_toggle_dark_on_mount () -> None :
2125 """It should be possible to toggle dark mode in on_mount."""
2226 async with OnMountDarkSwitch ().run_test () as pilot :
2327 assert not pilot .app .dark
2428
29+
2530class ActionDarkSwitch (App [None ]):
2631 """App for testing toggling dark mode from an action."""
2732
@@ -30,6 +35,7 @@ class ActionDarkSwitch(App[None]):
3035 def action_toggle (self ) -> None :
3136 self .dark = not self .dark
3237
38+
3339async def test_toggle_dark_in_action () -> None :
3440 """It should be possible to toggle dark mode with an action."""
3541 async with OnMountDarkSwitch ().run_test () as pilot :
0 commit comments