Implemented Delete feature in DataGridsManager.py. There is still a bug as DBEngine.delete is not implemented

Improved readability for tests using matcher
This commit is contained in:
2026-02-21 18:31:11 +01:00
parent 730f55d65b
commit d447220eae
12 changed files with 460 additions and 49 deletions

View File

@@ -7,7 +7,7 @@ from fasthtml.components import *
from myfasthtml.controls.Keyboard import Keyboard
from myfasthtml.controls.TreeView import TreeView, TreeNode
from myfasthtml.test.matcher import matches, TestObject, TestCommand, TestIcon, find_one, find, Contains, \
DoesNotContain
DoesNotContain, TestLabel
from .conftest import root_instance
@@ -46,7 +46,7 @@ class TestTreeviewBehaviour:
assert state.opened == []
assert state.selected is None
assert state.editing is None
assert state.icon_config == {}
assert state.icon_config == {'file': 'TreeViewFile', 'folder': 'TreeViewFolder'}
def test_i_can_create_empty_treeview(self, root_instance):
"""Test creating an empty TreeView."""
@@ -674,7 +674,7 @@ class TestTreeViewRender:
Div(
Div(
TestIcon("chevron_right20_regular"), # Collapsed toggle icon
Span("Parent"), # Label
TestLabel("Parent", icon="folder20_regular"),
Div( # Action buttons
TestIcon("add_circle20_regular"),
TestIcon("edit20_regular"),
@@ -736,7 +736,7 @@ class TestTreeViewRender:
expected_child_container = Div(
Div(
None, # No icon for leaf nodes
Span("Child1"),
TestLabel("Child1", icon="Document20Regular"),
Div(), # action buttons
cls=Contains("mf-treenode")
),
@@ -764,7 +764,7 @@ class TestTreeViewRender:
expected = Div(
Div(
None, # No icon for leaf nodes
Span("Leaf Node"), # Label
TestLabel("Leaf Node", icon="Document20Regular"), # Label
Div(), # Action buttons still present
),
cls=Contains("mf-treenode"),
@@ -792,7 +792,7 @@ class TestTreeViewRender:
expected = Div(
Div(
None, # No icon for leaf nodes
Span("Selected Node"),
TestLabel("Selected Node", icon="Document20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode", "selected")
),
@@ -872,7 +872,7 @@ class TestTreeViewRender:
root_expected = Div(
Div(
TestIcon("chevron_down20_regular"), # Expanded icon
Span("Root"),
TestLabel("Root", icon="Folder20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode"),
style=Contains("padding-left: 0px")
@@ -887,10 +887,10 @@ class TestTreeViewRender:
child_expected = Div(
Div(
TestIcon("chevron_down20_regular"), # Expanded icon
Span("Child"),
TestLabel("Child", icon="Folder20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode"),
style=Contains("padding-left: 20px")
style=Contains("padding-left: 45px")
),
cls="mf-treenode-container",
data_node_id=child.id
@@ -902,10 +902,10 @@ class TestTreeViewRender:
grandchild_expected = Div(
Div(
None, # No icon for leaf nodes
Span("Grandchild"),
TestLabel("Grandchild", icon="Document20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode"),
style=Contains("padding-left: 40px")
style=Contains("padding-left: 90px")
),
cls="mf-treenode-container",
data_node_id=grandchild.id
@@ -1071,7 +1071,7 @@ class TestTreeViewRender:
expected_root1 = Div(
Div(
None, # No icon for leaf nodes
Span("Root 1"),
TestLabel("Root 1", icon="Folder20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode")
),
@@ -1082,7 +1082,7 @@ class TestTreeViewRender:
expected_root2 = Div(
Div(
None, # No icon for leaf nodes
Span("Root 2"),
TestLabel("Root 2", icon="Folder20Regular"),
Div(), # Action buttons
cls=Contains("mf-treenode")
),