Skip to content

Commit 2cd38d1

Browse files
committed
added test
1 parent 54c3a2e commit 2cd38d1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/snapshot_tests/test_snapshots.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44

55
from tests.snapshot_tests.language_snippets import SNIPPETS
6+
from textual import events
67
from textual.app import App, ComposeResult
78
from textual.binding import Binding
89
from 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)

0 commit comments

Comments
 (0)