瀏覽代碼

add test_table

Falko Schindler 2 年之前
父節點
當前提交
a3b65cb496
共有 1 個文件被更改,包括 20 次插入0 次删除
  1. 20 0
      tests/test_table.py

+ 20 - 0
tests/test_table.py

@@ -0,0 +1,20 @@
+from nicegui import ui
+
+from .screen import Screen
+
+
+def test_update_table(screen: Screen):
+    table = ui.table({
+        'columnDefs': [{'field': 'name'}, {'field': 'age'}],
+        'rowData': [{'name': 'Alice', 'age': 18}],
+    })
+
+    screen.open('/')
+    screen.should_contain('Name')
+    screen.should_contain('Age')
+    screen.should_contain('Alice')
+    screen.should_contain('18')
+
+    table.options['rowData'][0]['age'] = 42
+    table.update()
+    screen.should_contain('42')