Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed May 18, 2024
1 parent 745d8fd commit b148131
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.61.0] - Unreleased

### Added

- Added App.get_default_screen

## [0.60.1] - 2024-05-15

### Fixed
Expand Down
17 changes: 17 additions & 0 deletions tests/test_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,20 @@ async def action_exit(self) -> None:
with pytest.raises(NoActiveWorker):
async with app.run_test() as pilot:
await pilot.press("x", "y")


async def test_default_custom_screen() -> None:
"""Test we can override the default screen."""

class CustomScreen(Screen):
pass

class CustomScreenApp(App):
def get_default_screen(self) -> Screen:
return CustomScreen()

app = CustomScreenApp()
async with app.run_test():
assert len(app.screen_stack) == 1
assert isinstance(app.screen_stack[0], CustomScreen)
assert app.screen is app.screen_stack[0]

0 comments on commit b148131

Please sign in to comment.