mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'main' into tree-node-parent-prop
This commit is contained in:
17
tests/tree/test_tree_node_label.py
Normal file
17
tests/tree/test_tree_node_label.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from textual.widgets import Tree, TreeNode
|
||||
from rich.text import Text
|
||||
|
||||
def test_tree_node_label() -> None:
|
||||
"""It should be possible to modify a TreeNode's label."""
|
||||
node = TreeNode(Tree[None]("Xenomorph Lifecycle"), None, 0, "Facehugger")
|
||||
assert node.label == Text("Facehugger")
|
||||
node.label = "Chestbuster"
|
||||
assert node.label == Text("Chestbuster")
|
||||
|
||||
def test_tree_node_label_via_tree() -> None:
|
||||
"""It should be possible to modify a TreeNode's label when created via a Tree."""
|
||||
tree = Tree[None]("Xenomorph Lifecycle")
|
||||
node = tree.root.add("Facehugger")
|
||||
assert node.label == Text("Facehugger")
|
||||
node.label = "Chestbuster"
|
||||
assert node.label == Text("Chestbuster")
|
||||
Reference in New Issue
Block a user