|
@@ -156,6 +156,32 @@ def upload_table():
|
|
|
''')
|
|
|
|
|
|
|
|
|
+doc.text('Autocomplete', '''
|
|
|
+ The `UserInteraction` object returned by `user.find(...)` provides methods to trigger events on the found elements.
|
|
|
+ This demo shows how to trigger a "keydown.tab" event to autocomplete an input field.
|
|
|
+''')
|
|
|
+
|
|
|
+
|
|
|
+@doc.ui
|
|
|
+def trigger_events():
|
|
|
+ with ui.row().classes('gap-4 items-stretch'):
|
|
|
+ with python_window(classes='w-[500px]', title='some UI code'):
|
|
|
+ ui.markdown('''
|
|
|
+ ```python
|
|
|
+ fruits = ['apple', 'banana', 'cherry']
|
|
|
+ ui.input(label='fruit', autocomplete=fruits)
|
|
|
+ ```
|
|
|
+ ''')
|
|
|
+ with python_window(classes='w-[500px]', title='user assertions'):
|
|
|
+ ui.markdown('''
|
|
|
+ ```python
|
|
|
+ await user.open('/')
|
|
|
+ user.find('fruit').type('a').trigger('keydown.tab')
|
|
|
+ await user.should_see('apple')
|
|
|
+ ```
|
|
|
+ ''')
|
|
|
+
|
|
|
+
|
|
|
doc.text('Test Downloads', '''
|
|
|
You can verify that a download was triggered by checking `user.downloads.http_responses`.
|
|
|
By awaiting `user.downloads.next()` you can get the next download response.
|