@@ -4,7 +4,7 @@ source "./lib/bashunit_ext"
4
4
pabin=./parseArger
5
5
ex=(" $pabin " generate)
6
6
exp=(" $pabin " html-form)
7
- spos=(" my-arg" " 'An argument'" )
7
+ spos=(" my-arg" " 'An argument'" --one-of val --one-of val1 --one-of val2 )
8
8
sopt=(" my-opt" " 'An opt'" -r -s o --alias opt-pt --default-value " 'aValue'" )
9
9
sflg=(" my-flag" " 'A flag'" -s f --no-name nope --alias flg --no-alias noflg --on)
10
10
snst=(" my-nst" " 'A nested opt'" )
@@ -85,6 +85,21 @@ function test_html_input_class() {
85
85
rm " $tfile " ;
86
86
}
87
87
88
+ function test_html_input_container_class() {
89
+ local tfile=" ${tftmp_file} _html_input_container_class" ;
90
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
91
+ local pex_=(" ${exp[@]} " " $tfile " --input-container-class " my-input-class" )
92
+
93
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
94
+ assert_is_file " $tfile " ;
95
+
96
+ local pexout=" $( " ${pex_[@]} " ) " ;
97
+ assert_exit_code " 0" " $? " ;
98
+ assert_contains " my-input-class" " $pexout " ;
99
+
100
+ rm " $tfile " ;
101
+ }
102
+
88
103
function test_html_label_class() {
89
104
local tfile=" ${tftmp_file} _html_label_class" ;
90
105
local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
@@ -97,5 +112,95 @@ function test_html_label_class() {
97
112
assert_exit_code " 0" " $? " ;
98
113
assert_contains " my-label-class" " $pexout " ;
99
114
115
+ rm " $tfile " ;
116
+ }
117
+
118
+ function test_html_select_class() {
119
+ local tfile=" ${tftmp_file} _html_select_class" ;
120
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
121
+ local pex_=(" ${exp[@]} " " $tfile " --select-class " my-select-class" )
122
+
123
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
124
+ assert_is_file " $tfile " ;
125
+
126
+ local pexout=" $( " ${pex_[@]} " ) " ;
127
+ assert_exit_code " 0" " $? " ;
128
+ assert_contains " my-select-class" " $pexout " ;
129
+
130
+ rm " $tfile " ;
131
+ }
132
+
133
+ function test_html_checkbox_label_class() {
134
+ local tfile=" ${tftmp_file} _html_checkbox_label_class" ;
135
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
136
+ local pex_=(" ${exp[@]} " " $tfile " --checkbox-label-class " my-checkbox-label-class" )
137
+
138
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
139
+ assert_is_file " $tfile " ;
140
+
141
+ local pexout=" $( " ${pex_[@]} " ) " ;
142
+ assert_exit_code " 0" " $? " ;
143
+ assert_contains " my-checkbox-label-class" " $pexout " ;
144
+
145
+ rm " $tfile " ;
146
+ }
147
+
148
+ function test_html_checkbox_class() {
149
+ local tfile=" ${tftmp_file} _html_checkbox_class" ;
150
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
151
+ local pex_=(" ${exp[@]} " " $tfile " --checkbox-class " my-checkbox-class" )
152
+
153
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
154
+ assert_is_file " $tfile " ;
155
+
156
+ local pexout=" $( " ${pex_[@]} " ) " ;
157
+ assert_exit_code " 0" " $? " ;
158
+ assert_contains " my-checkbox-class" " $pexout " ;
159
+
160
+ rm " $tfile " ;
161
+ }
162
+
163
+ function test_html_no_form() {
164
+ local tfile=" ${tftmp_file} _html_no_form" ;
165
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
166
+ local pex_=(" ${exp[@]} " " $tfile " --no-form)
167
+
168
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
169
+ assert_is_file " $tfile " ;
170
+
171
+ local pexout=" $( " ${pex_[@]} " ) " ;
172
+ assert_exit_code " 0" " $? " ;
173
+ assert_not_contains " <form" " $pexout " ;
174
+
175
+ rm " $tfile " ;
176
+ }
177
+
178
+ function test_html_no_button() {
179
+ local tfile=" ${tftmp_file} _html_no_button" ;
180
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
181
+ local pex_=(" ${exp[@]} " " $tfile " --no-button)
182
+
183
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
184
+ assert_is_file " $tfile " ;
185
+
186
+ local pexout=" $( " ${pex_[@]} " ) " ;
187
+ assert_exit_code " 0" " $? " ;
188
+ assert_not_contains " <button" " $pexout " ;
189
+
190
+ rm " $tfile " ;
191
+ }
192
+
193
+ function test_html_no_js() {
194
+ local tfile=" ${tftmp_file} _html_no_js" ;
195
+ local ex_=(" ${ex[@]} " --output " $tfile " --opt " ${sopt[*]} " --flag " ${sflg[*]} " --nested " ${snst[*]} " --pos " ${spos[*]} " )
196
+ local pex_=(" ${exp[@]} " " $tfile " --no-js)
197
+
198
+ assert_exit_code " 0" " $( " ${ex_[@]} " ) " ;
199
+ assert_is_file " $tfile " ;
200
+
201
+ local pexout=" $( " ${pex_[@]} " ) " ;
202
+ assert_exit_code " 0" " $? " ;
203
+ assert_not_contains " <script" " $pexout " ;
204
+
100
205
rm " $tfile " ;
101
206
}
0 commit comments