Skip to content

Commit 7b825bb

Browse files
committed
test fixes
1 parent 990c9b8 commit 7b825bb

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tests/animations/test_loading_indicator_animation.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
from textual.app import App
7-
from textual.widgets import LoadingIndicator
87

98

109
async def test_loading_indicator_is_not_static_on_full() -> None:
@@ -15,7 +14,7 @@ async def test_loading_indicator_is_not_static_on_full() -> None:
1514
async with app.run_test() as pilot:
1615
app.screen.loading = True
1716
await pilot.pause()
18-
indicator = app.query_one(LoadingIndicator)
17+
indicator = app.screen._cover_widget
1918
assert str(indicator.render()) != "Loading..."
2019

2120

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

3332

@@ -39,5 +38,5 @@ async def test_loading_indicator_is_static_on_none() -> None:
3938
async with app.run_test() as pilot:
4039
app.screen.loading = True
4140
await pilot.pause()
42-
indicator = app.query_one(LoadingIndicator)
41+
indicator = app.screen._cover_widget
4342
assert str(indicator.render()) == "Loading..."

tests/test_widget.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,23 +425,23 @@ def compose(self) -> ComposeResult:
425425
app = pilot.app
426426
label = app.query_one(Label)
427427
assert label.loading == False
428-
assert len(label.query(LoadingIndicator)) == 0
428+
assert label._cover_widget is None
429429

430430
label.loading = True
431431
await pilot.pause()
432-
assert len(label.query(LoadingIndicator)) == 1
432+
assert label._cover_widget is not None
433433

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

438438
label.loading = False
439439
await pilot.pause()
440-
assert len(label.query(LoadingIndicator)) == 0
440+
assert label._cover_widget is None
441441

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

446446

447447
async def test_is_mounted_property():

0 commit comments

Comments
 (0)