File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 33import pytest
44
55from tests .snapshot_tests .language_snippets import SNIPPETS
6+ from textual import events
67from textual .app import App , ComposeResult
78from textual .binding import Binding
89from textual .containers import Vertical
@@ -1676,3 +1677,37 @@ def on_mount(self) -> None:
16761677
16771678 # ctrl+m to maximize, escape *should* minimize
16781679 assert snap_compare (TextAreaExample (), press = ["ctrl+m" , "escape" ])
1680+
1681+
1682+ async def test_app_focus_style (snap_compare ):
1683+ class FocusApp (App ):
1684+ CSS = """
1685+ Label {
1686+ padding: 1 2;
1687+ margin: 1 2;
1688+ background: $panel;
1689+ border: $primary;
1690+ }
1691+ App:focus {
1692+ .blurred {
1693+ visibility: hidden;
1694+ }
1695+ }
1696+
1697+ App:blur {
1698+ .focussed {
1699+ visibility: hidden;
1700+ }
1701+ }
1702+
1703+ """
1704+
1705+ def compose (self ) -> ComposeResult :
1706+ yield Label ("BLURRED" , classes = "blurred" )
1707+ yield Label ("FOCUSED" , classes = "focussed" )
1708+
1709+ async def run_before (pilot : Pilot ) -> None :
1710+ pilot .app .post_message (events .AppBlur ())
1711+ await pilot .pause ()
1712+
1713+ assert snap_compare (FocusApp (), run_before = run_before )
You can’t perform that action at this time.
0 commit comments