Pārlūkot izejas kodu

test removal of parent element (currently failing)

Falko Schindler 1 gadu atpakaļ
vecāks
revīzija
ad9916e743
1 mainītis faili ar 24 papildinājumiem un 0 dzēšanām
  1. 24 0
      tests/test_element_delete.py

+ 24 - 0
tests/test_element_delete.py

@@ -1,3 +1,5 @@
+import pytest
+
 from nicegui import ui
 
 from .screen import Screen
@@ -54,3 +56,25 @@ def test_clear(screen: Screen):
     assert a.is_deleted
     assert b.is_deleted
     assert c.is_deleted
+
+
+@pytest.mark.skip(reason='needs fix in element.py')  # TODO
+def test_remove_parent(screen: Screen):
+    with ui.element() as container:
+        with ui.row() as row:
+            a = ui.label('Label A')
+            b = ui.label('Label B')
+            c = ui.label('Label C')
+
+    ui.button('Remove parent', on_click=lambda: container.remove(row))
+
+    screen.open('/')
+    screen.click('Remove parent')
+    screen.wait(0.5)
+    screen.should_not_contain('Label A')
+    screen.should_not_contain('Label B')
+    screen.should_not_contain('Label C')
+    assert row.is_deleted
+    assert a.is_deleted
+    assert b.is_deleted
+    assert c.is_deleted