mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
@@ -1,7 +1,7 @@
|
||||
"""Test Widget.disabled."""
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import (
|
||||
Button,
|
||||
DataTable,
|
||||
@@ -21,7 +21,7 @@ class DisableApp(App[None]):
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Compose the child widgets."""
|
||||
yield Vertical(
|
||||
yield VerticalScroll(
|
||||
Button(),
|
||||
DataTable(),
|
||||
DirectoryTree("."),
|
||||
@@ -56,7 +56,7 @@ async def test_enabled_widgets_have_enabled_pseudo_class() -> None:
|
||||
async def test_all_individually_disabled() -> None:
|
||||
"""Post-disable all widgets should report being disabled."""
|
||||
async with DisableApp().run_test() as pilot:
|
||||
for node in pilot.app.screen.query("Vertical > *"):
|
||||
for node in pilot.app.screen.query("VerticalScroll > *"):
|
||||
node.disabled = True
|
||||
assert all(
|
||||
node.disabled for node in pilot.app.screen.query("#test-container > *")
|
||||
@@ -77,7 +77,7 @@ async def test_disabled_widgets_have_disabled_pseudo_class() -> None:
|
||||
async def test_disable_via_container() -> None:
|
||||
"""All child widgets should appear (to CSS) as disabled by a container being disabled."""
|
||||
async with DisableApp().run_test() as pilot:
|
||||
pilot.app.screen.query_one("#test-container", Vertical).disabled = True
|
||||
pilot.app.screen.query_one("#test-container", VerticalScroll).disabled = True
|
||||
assert all(
|
||||
node.has_pseudo_class("disabled") and not node.has_pseudo_class("enabled")
|
||||
for node in pilot.app.screen.query("#test-container > *")
|
||||
|
||||
Reference in New Issue
Block a user