Ver Fonte

fix pytest

Falko Schindler há 1 ano atrás
pai
commit
785d32472d
2 ficheiros alterados com 4 adições e 3 exclusões
  1. 1 1
      nicegui/elements/aggrid.py
  2. 3 2
      tests/test_aggrid.py

+ 1 - 1
nicegui/elements/aggrid.py

@@ -143,7 +143,7 @@ class AgGrid(Element, component='aggrid.js', libraries=['lib/aggrid/ag-grid-comm
         If the function is awaited, the result of the method call is returned.
         If the function is awaited, the result of the method call is returned.
         Otherwise, the method is executed without waiting for a response.
         Otherwise, the method is executed without waiting for a response.
 
 
-        :param row_id: id of the row
+        :param row_id: id of the row (as defined by the ``getRowId`` option)
         :param name: name of the method
         :param name: name of the method
         :param args: arguments to pass to the method
         :param args: arguments to pass to the method
         :param timeout: timeout in seconds (default: 1 second)
         :param timeout: timeout in seconds (default: 1 second)

+ 3 - 2
tests/test_aggrid.py

@@ -217,9 +217,10 @@ def test_problematic_datatypes(screen: Screen):
 def test_run_row_method(screen: Screen):
 def test_run_row_method(screen: Screen):
     grid = ui.aggrid({
     grid = ui.aggrid({
         'columnDefs': [{'field': 'name'}, {'field': 'age'}],
         'columnDefs': [{'field': 'name'}, {'field': 'age'}],
-        'rowData': [{'id': 'alice', 'name': 'Alice', 'age': 18}],
+        'rowData': [{'name': 'Alice', 'age': 18}],
+        ':getRowId': '(params) => params.data.name',
     })
     })
-    ui.button('Update', on_click=lambda: grid.run_row_method('alice', 'setDataValue', 'age', 42))
+    ui.button('Update', on_click=lambda: grid.run_row_method('Alice', 'setDataValue', 'age', 42))
 
 
     screen.open('/')
     screen.open('/')
     screen.should_contain('Alice')
     screen.should_contain('Alice')