Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 2, 2024
1 parent 990c9b8 commit 7b825bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions tests/animations/test_loading_indicator_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

from textual.app import App
from textual.widgets import LoadingIndicator


async def test_loading_indicator_is_not_static_on_full() -> None:
Expand All @@ -15,7 +14,7 @@ async def test_loading_indicator_is_not_static_on_full() -> None:
async with app.run_test() as pilot:
app.screen.loading = True
await pilot.pause()
indicator = app.query_one(LoadingIndicator)
indicator = app.screen._cover_widget
assert str(indicator.render()) != "Loading..."


Expand All @@ -27,7 +26,7 @@ async def test_loading_indicator_is_not_static_on_basic() -> None:
async with app.run_test() as pilot:
app.screen.loading = True
await pilot.pause()
indicator = app.query_one(LoadingIndicator)
indicator = app.screen._cover_widget
assert str(indicator.render()) != "Loading..."


Expand All @@ -39,5 +38,5 @@ async def test_loading_indicator_is_static_on_none() -> None:
async with app.run_test() as pilot:
app.screen.loading = True
await pilot.pause()
indicator = app.query_one(LoadingIndicator)
indicator = app.screen._cover_widget
assert str(indicator.render()) == "Loading..."
10 changes: 5 additions & 5 deletions tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,23 +425,23 @@ def compose(self) -> ComposeResult:
app = pilot.app
label = app.query_one(Label)
assert label.loading == False
assert len(label.query(LoadingIndicator)) == 0
assert label._cover_widget is None

label.loading = True
await pilot.pause()
assert len(label.query(LoadingIndicator)) == 1
assert label._cover_widget is not None

label.loading = True # Setting to same value is a null-op
await pilot.pause()
assert len(label.query(LoadingIndicator)) == 1
assert label._cover_widget is not None

label.loading = False
await pilot.pause()
assert len(label.query(LoadingIndicator)) == 0
assert label._cover_widget is None

label.loading = False # Setting to same value is a null-op
await pilot.pause()
assert len(label.query(LoadingIndicator)) == 0
assert label._cover_widget is None


async def test_is_mounted_property():
Expand Down

0 comments on commit 7b825bb

Please sign in to comment.