-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2621 from Textualize/leave-footer-push-modal-screen
Leave footer when pushing modal screen
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.geometry import Offset | ||
from textual.screen import ModalScreen | ||
from textual.widgets import Footer, Label | ||
|
||
|
||
async def test_footer_highlight_when_pushing_modal(): | ||
"""Regression test for https://github.com/Textualize/textual/issues/2606""" | ||
|
||
class MyModalScreen(ModalScreen): | ||
def compose(self) -> ComposeResult: | ||
yield Label("apple") | ||
|
||
class MyApp(App[None]): | ||
BINDINGS = [("a", "p", "push")] | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Footer() | ||
|
||
def action_p(self): | ||
self.push_screen(MyModalScreen()) | ||
|
||
app = MyApp() | ||
async with app.run_test(size=(80, 2)) as pilot: | ||
await pilot.hover(None, Offset(0, 1)) | ||
await pilot.click(None, Offset(0, 1)) | ||
assert isinstance(app.screen, MyModalScreen) | ||
assert app.screen_stack[0].query_one(Footer).highlight_key is None |