mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Fix snapshot test by resetting colour cycle.
This commit is contained in:
@@ -74,6 +74,11 @@ class Placeholder(Static):
|
||||
|
||||
variant: Reactive[PlaceholderVariant] = reactive("default")
|
||||
|
||||
@classmethod
|
||||
def reset_color_cycle(cls) -> None:
|
||||
"""Reset the placeholder background color cycle."""
|
||||
cls.COLORS = cycle(_PLACEHOLDER_BACKGROUND_COLORS)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
variant: PlaceholderVariant = "default",
|
||||
|
||||
@@ -2,6 +2,8 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from textual.widgets import Placeholder
|
||||
|
||||
# These paths should be relative to THIS directory.
|
||||
WIDGET_EXAMPLES_DIR = Path("../../docs/examples/widgets")
|
||||
LAYOUT_EXAMPLES_DIR = Path("../../docs/examples/guide/layout")
|
||||
@@ -79,6 +81,7 @@ def test_buttons_render(snap_compare):
|
||||
|
||||
def test_placeholder_render(snap_compare):
|
||||
# Testing the rendering of the multiple placeholder variants and labels.
|
||||
Placeholder.reset_color_cycle()
|
||||
assert snap_compare(WIDGET_EXAMPLES_DIR / "placeholder.py")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user