@@ -19,6 +19,92 @@ def target():
1919 template .basic_output ()
2020 template .background_output ()
2121
22+ def check_item (data ):
23+ pass
24+
25+ input_group ('Input group' , [
26+ input ('Text' , type = TEXT , datalist = ['data-%s' % i for i in range (10 )], name = 'text' ,
27+ required = True , help_text = 'required=True' , validate = check_item ),
28+ input ('Number' , type = NUMBER , value = "42" , name = 'number' , validate = check_item ),
29+ input ('Float' , type = FLOAT , name = 'float' , validate = check_item ),
30+ input ('Password' , type = PASSWORD , name = 'password' , validate = check_item ),
31+
32+ textarea ('Textarea' , rows = 3 , maxlength = 20 , name = 'textarea' ,
33+ help_text = 'rows=3, maxlength=20' , validate = check_item ),
34+
35+ textarea ('Code' , name = 'code' , code = {
36+ 'lineNumbers' : False ,
37+ 'indentUnit' : 2 ,
38+ }, value = 'import something\n # Write your python code' , validate = check_item ),
39+
40+ select ('select-multiple' , [
41+ {'label' : '标签0,selected' , 'value' : '0' , 'selected' : True },
42+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
43+ ('标签2,selected' , '2' , True ),
44+ ('标签3' , '3' ),
45+ ('标签4,disabled' , '4' , False , True ),
46+ '标签5,selected' ,
47+ ], name = 'select-multiple' , multiple = True , value = ['标签5,selected' ], required = True ,
48+ help_text = 'required至少选择一项' , validate = check_item ),
49+
50+ select ('select' , [
51+ {'label' : '标签0' , 'value' : '0' , 'selected' : False },
52+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
53+ ('标签2' , '2' , False ),
54+ ('标签3' , '3' ),
55+ ('标签4,disabled' , '4' , False , True ),
56+ '标签5,selected' ,
57+ ], name = 'select' , value = ['标签5,selected' ], validate = check_item ),
58+
59+ checkbox ('checkbox-inline' , [
60+ {'label' : '标签0,selected' , 'value' : '0' , 'selected' : False },
61+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
62+ ('标签2,selected' , '2' , True ),
63+ ('标签3' , '3' ),
64+ ('标签4,disabled' , '4' , False , True ),
65+ '标签5,selected' ,
66+ ], inline = True , name = 'checkbox-inline' , value = ['标签5,selected' , '标签0' , '标签0,selected' ], validate = check_item ),
67+
68+ checkbox ('checkbox' , [
69+ {'label' : '标签0,selected' , 'value' : '0' , 'selected' : True },
70+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
71+ ('标签2,selected' , '2' , True ),
72+ ('标签3' , '3' ),
73+ ('标签4,disabled' , '4' , False , True ),
74+ '标签5' ,
75+ ], name = 'checkbox' , validate = check_item ),
76+
77+ radio ('radio-inline' , [
78+ {'label' : '标签0' , 'value' : '0' , 'selected' : False },
79+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
80+ ('标签2' , '2' , False ),
81+ ('标签3' , '3' ),
82+ ('标签4,disabled' , '4' , False , True ),
83+ '标签5,selected' ,
84+ ], inline = True , name = 'radio-inline' , value = '标签5,selected' , validate = check_item ),
85+
86+ radio ('radio' , [
87+ {'label' : '标签0' , 'value' : '0' , 'selected' : False },
88+ {'label' : '标签1,disabled' , 'value' : '1' , 'disabled' : True },
89+ ('标签2' , '2' , False ),
90+ ('标签3' , '3' ),
91+ ('标签4,disabled' , '4' , False , True ),
92+ '标签5,selected' ,
93+ ], inline = False , name = 'radio' , value = '标签5,selected' , validate = check_item ),
94+
95+ file_upload ('file_upload' , name = 'file_upload' , max_size = '10m' ),
96+
97+ actions ('actions' , [
98+ {'label' : '提交' , 'value' : 'submit' },
99+ ('提交2' , 'submit2' ),
100+ '提交3' ,
101+ {'label' : 'disabled' , 'disabled' : True },
102+ ('重置' , 'reset' , 'reset' ),
103+ {'label' : '取消' , 'type' : 'cancel' },
104+ ], name = 'actions' , help_text = 'actions' ),
105+
106+ ] )
107+
22108 run_as_function (template .basic_input ())
23109 actions (buttons = ['Continue' ])
24110 template .background_input ()
@@ -32,6 +118,8 @@ def test(server_proc: subprocess.Popen, browser: Chrome):
32118 time .sleep (1 )
33119 template .save_output (browser , '1.basic.html' )
34120
121+ browser .get ('http://localhost:8080/' ) # to close current session
122+
35123 template .test_defer_call ()
36124
37125
0 commit comments