File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1
- from typing import List
2
-
3
1
from selenium .webdriver .common .keys import Keys
4
2
5
3
from nicegui import ui
@@ -24,22 +22,23 @@ def test_open_close_dialog(screen: Screen):
24
22
25
23
def test_await_dialog (screen : Screen ):
26
24
with ui .dialog () as dialog , ui .card ():
27
- ui .label ('Are you sure?' )
28
- with ui .row ():
29
- ui .button ('Yes' , on_click = lambda : dialog .submit ('Yes' ))
30
- ui .button ('No' , on_click = lambda : dialog .submit ('No' ))
25
+ ui .button ('Yes' , on_click = lambda : dialog .submit ('Yes' ))
26
+ ui .button ('No' , on_click = lambda : dialog .submit ('No' ))
31
27
32
28
async def show () -> None :
33
- results . append ( await dialog )
34
- results : List [ str ] = []
29
+ ui . notify ( f'Result: { await dialog } ' )
30
+
35
31
ui .button ('Open' , on_click = show )
36
32
37
33
screen .open ('/' )
38
34
screen .click ('Open' )
39
35
screen .click ('Yes' )
36
+ screen .should_contain ('Result: Yes' )
37
+
40
38
screen .click ('Open' )
41
39
screen .click ('No' )
40
+ screen .should_contain ('Result: No' )
41
+
42
42
screen .click ('Open' )
43
43
screen .type (Keys .ESCAPE )
44
- screen .wait (0.5 )
45
- assert results == ['Yes' , 'No' , None ]
44
+ screen .should_contain ('Result: None' )
You can’t perform that action at this time.
0 commit comments