This commit is contained in:
Will McGugan
2023-02-22 14:33:23 +00:00
parent 3c9e89d778
commit 5686147909
2 changed files with 4 additions and 4 deletions

View File

@@ -408,6 +408,7 @@ class Stylesheet:
component_classes = node._get_component_classes()
if component_classes:
# Create virtual nodes that exist to extract styles
refresh_node = False
old_component_styles = node._component_styles.copy()
node._component_styles.clear()
@@ -419,6 +420,7 @@ class Stylesheet:
not refresh_node
and old_component_styles.get(component) != virtual_node.styles
):
# If the styles have changed we want to refresh the node
refresh_node = True
node._component_styles[component] = virtual_node.styles
if refresh_node:

View File

@@ -213,7 +213,7 @@ def test_demo(snap_compare):
"""Test the demo app (python -m textual)"""
assert snap_compare(
Path("../../src/textual/demo.py"),
press=["down", "down", "down", "_"],
press=["down", "down", "down"],
terminal_size=(100, 30),
)
@@ -238,6 +238,4 @@ def test_disabled_widgets(snap_compare):
def test_focus_component_class(snap_compare):
assert snap_compare(
SNAPSHOT_APPS_DIR / "focus_component_class.py", press=["tab", "_"]
)
assert snap_compare(SNAPSHOT_APPS_DIR / "focus_component_class.py", press=["tab"])