Index: openacs-4/packages/xowiki/tcl/test/api-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/Attic/api-test-procs.tcl,v diff -u -N -r1.1.2.14 -r1.1.2.15 --- openacs-4/packages/xowiki/tcl/test/api-test-procs.tcl 2 Jan 2022 16:25:11 -0000 1.1.2.14 +++ openacs-4/packages/xowiki/tcl/test/api-test-procs.tcl 1 Feb 2022 21:10:35 -0000 1.1.2.15 @@ -198,6 +198,53 @@ {xxx} } +aa_register_case \ + -cats {api smoke production_safe} \ + -procs { + "::xowiki::Page instproc create_form_fields_from_form_constraints" + } \ + form_fields_from_form_constraints { + + Create (different) types of form-field with minimal interface. + + } { + ::xo::require_html_procs + set p1 [xowiki::Page new \ + -name en:foo \ + -package_id [ad_conn package_id] \ + -destroy_on_cleanup] + aa_log "p1 = $p1" + foreach fc { + {t:textarea,value=foo} + {show_ip:boolean,horizontal=true,default=t,label=#xowf.Show_IP#} + {date:date,default=2022-02-01 22:03:00} + } props { + {name t rows 2 cols 80} + {name show_ip value t horizontal true required false label #xowf.Show_IP#} + {name date value "2022-02-01 22:03:00"} + } { + set ff [$p1 create_form_fields_from_form_constraints \ + [list $fc]] + + aa_log "
[$ff serialize]
" + #aa_log "[$ff name] [$ff info class] [$ff value]" + foreach {k v} $props { + aa_true "$k has value '$v' == '[$ff $k]'" {[$ff $k] eq $v} + } + dom createDocument html doc + set root [$doc documentElement] + $root appendFromScript { + $ff render_input + } + # + # Here we could check with xpath the content of the rended + # form field. + # + set HTML [lmap n [$root childNode] {$n asHTML}] + aa_log "
[ns_quotehtml $HTML]
" + } + } + # # Local variables: # mode: tcl