@@ -1094,13 +1094,22 @@ mod tests {
10941094 } ,
10951095 PasswordFieldOptions {
10961096 max_length : Some ( 10 ) ,
1097+ min_length : Some ( 5 ) ,
1098+ size : Some ( 15 ) ,
1099+ autocomplete : Some ( AutoComplete :: Value ( "foo bar" . to_string ( ) ) ) ,
1100+ placeholder : Some ( "Enter password" . to_string ( ) ) ,
1101+ readonly : Some ( false ) ,
10971102 } ,
10981103 ) ;
10991104 let html = field. to_string ( ) ;
11001105 assert ! ( html. contains( "type=\" password\" " ) ) ;
11011106 assert ! ( html. contains( "required" ) ) ;
11021107 assert ! ( html. contains( "maxlength=\" 10\" " ) ) ;
1108+ assert ! ( html. contains( "minlength=\" 5\" " ) ) ;
1109+ assert ! ( html. contains( "autocomplete=\" foo bar\" " ) ) ;
1110+ assert ! ( html. contains( "placeholder=\" Enter password\" " ) ) ;
11031111 }
1112+
11041113 #[ cot:: test]
11051114 async fn password_field_clean_value ( ) {
11061115 let mut field = PasswordField :: with_options (
@@ -1131,18 +1140,31 @@ mod tests {
11311140 required : true ,
11321141 } ,
11331142 EmailFieldOptions {
1134- min_length : Some ( 10 ) ,
1135- max_length : Some ( 50 ) ,
1143+ max_length : Some ( 10 ) ,
1144+ min_length : Some ( 5 ) ,
1145+ size : Some ( 15 ) ,
1146+ autocomplete : Some ( AutoComplete :: Value ( "foo bar" . to_string ( ) ) ) ,
1147+ dirname : Some ( "dir" . to_string ( ) ) ,
1148+ list : Some ( List :: new ( [ "foo@example.com" , "baz@example.com" ] ) ) ,
1149+ placeholder : Some ( "Enter text" . to_string ( ) ) ,
1150+ readonly : Some ( true ) ,
11361151 } ,
11371152 ) ;
11381153
11391154 let html = field. to_string ( ) ;
1155+
11401156 assert ! ( html. contains( "type=\" email\" " ) ) ;
11411157 assert ! ( html. contains( "required" ) ) ;
1142- assert ! ( html. contains( "minlength=\" 10 \" " ) ) ;
1143- assert ! ( html. contains( "maxlength=\" 50 \" " ) ) ;
1158+ assert ! ( html. contains( "minlength=\" 5 \" " ) ) ;
1159+ assert ! ( html. contains( "maxlength=\" 10 \" " ) ) ;
11441160 assert ! ( html. contains( "name=\" test_id\" " ) ) ;
11451161 assert ! ( html. contains( "id=\" test_id\" " ) ) ;
1162+ assert ! ( html. contains( "placeholder=\" Enter text\" " ) ) ;
1163+ assert ! ( html. contains( "readonly" ) ) ;
1164+ assert ! ( html. contains( "autocomplete=\" foo bar\" " ) ) ;
1165+ assert ! ( html. contains( "dirname=\" dir\" " ) ) ;
1166+ assert ! ( html. contains( "list=\" __test_id_datalist\" " ) ) ;
1167+ assert ! ( html. contains( r#"<datalist id="__test_id_datalist"><option value="foo@example.com">foo@example.com</option><option value="baz@example.com">baz@example.com</option></datalist>"# ) ) ;
11461168 }
11471169
11481170 #[ cot:: test]
@@ -1286,13 +1308,22 @@ mod tests {
12861308 IntegerFieldOptions {
12871309 min : Some ( 1 ) ,
12881310 max : Some ( 10 ) ,
1311+ placeholder : Some ( "Enter text" . to_string ( ) ) ,
1312+ readonly : Some ( false ) ,
1313+ step : Some ( Step :: Value ( 10 ) ) ,
12891314 } ,
12901315 ) ;
12911316 let html = field. to_string ( ) ;
1317+
12921318 assert ! ( html. contains( "type=\" number\" " ) ) ;
12931319 assert ! ( html. contains( "required" ) ) ;
12941320 assert ! ( html. contains( "min=\" 1\" " ) ) ;
12951321 assert ! ( html. contains( "max=\" 10\" " ) ) ;
1322+ assert ! ( html. contains( "step=\" 10\" " ) ) ;
1323+ assert ! ( html. contains( "placeholder=\" Enter text\" " ) ) ;
1324+ assert ! ( html. contains( "name=\" test\" " ) ) ;
1325+ assert ! ( html. contains( "id=\" test\" " ) ) ;
1326+ assert ! ( !html. contains( "readonly" ) ) ;
12961327 }
12971328
12981329 #[ cot:: test]
@@ -1434,13 +1465,22 @@ mod tests {
14341465 FloatFieldOptions {
14351466 min : Some ( 1.5 ) ,
14361467 max : Some ( 10.7 ) ,
1468+ placeholder : Some ( "Enter text" . to_string ( ) ) ,
1469+ readonly : Some ( true ) ,
1470+ step : Some ( Step :: Any ) ,
14371471 } ,
14381472 ) ;
14391473 let html = field. to_string ( ) ;
1474+
14401475 assert ! ( html. contains( "type=\" number\" " ) ) ;
14411476 assert ! ( html. contains( "required" ) ) ;
14421477 assert ! ( html. contains( "min=\" 1.5\" " ) ) ;
14431478 assert ! ( html. contains( "max=\" 10.7\" " ) ) ;
1479+ assert ! ( html. contains( "step=\" any\" " ) ) ;
1480+ assert ! ( html. contains( "placeholder=\" Enter text\" " ) ) ;
1481+ assert ! ( html. contains( "name=\" test\" " ) ) ;
1482+ assert ! ( html. contains( "id=\" test\" " ) ) ;
1483+ assert ! ( html. contains( "readonly" ) ) ;
14441484 }
14451485
14461486 #[ cot:: test]
0 commit comments