Index: openacs-4/packages/xowiki/tcl/test/xowiki-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/xowiki-test-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/xowiki/tcl/test/xowiki-test-procs.tcl 3 Apr 2019 14:43:11 -0000 1.1.2.3 +++ openacs-4/packages/xowiki/tcl/test/xowiki-test-procs.tcl 7 Apr 2019 15:47:00 -0000 1.1.2.4 @@ -111,7 +111,7 @@ aa_log "Form $form_name created" ########################################################### - aa_section "Create an instance of the form" + aa_section "Create an instance of $form_name" ########################################################### set page_name $lang:cb1 @@ -129,7 +129,7 @@ aa_log "Page $page_name created" set extra_url_parameter {{m edit}} - aa_log "check content of the fresh instance" + aa_log "Check content of the fresh instance" set d [acs::test::http -last_request $request_info [export_vars -base $instance/$testfolder/$page_name $extra_url_parameter]] acs::test::reply_has_status_code $d 200 @@ -153,7 +153,7 @@ } ########################################################### - aa_section "Edit the instance of the page" + aa_section "Edit the instance of $form_name" ########################################################### ::xowiki::test::edit_form_page \ @@ -165,7 +165,7 @@ _title "edited $page_name" }] - aa_log "check content of the edited instance" + aa_log "Check content of the edited instance" set d [acs::test::http -user_id $user_id [export_vars -base $instance/$testfolder/$page_name $extra_url_parameter]] acs::test::reply_has_status_code $d 200 @@ -184,7 +184,97 @@ aa_equals "input_box5 box checked (mycompound)" [$input_box5 hasAttribute checked] 0 } + set form_name $lang:Repeat.form + ########################################################### + aa_section "Create form $form_name" + ########################################################### + # + # Create a form with a repeated field. + # + ::xowiki::test::create_form \ + -last_request $request_info \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -name $form_name \ + -update [subst { + title "Checkbox Testing Form" + nls_language $locale + text {

@txt@

} + text.format text/html + form {
@txt@
} + form.format text/html + form_constraints { + _page_order:omit _title:omit _nls_language:omit _description:omit + txt:text,repeat=1..5,default=t1 + } + }] + aa_log "Form $form_name created" + set page_name $lang:r1 + ########################################################### + aa_section "Create an instance $page_name of $form_name" + ########################################################### + + ::xowiki::test::create_form_page \ + -last_request $request_info \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -form_name $form_name \ + -update [subst { + _name $page_name + _title "fresh $page_name" + }] + + aa_log "Page $page_name created" + + set extra_url_parameter {{m edit}} + aa_log "Check content of the fresh instance" + set d [acs::test::http -last_request $request_info [export_vars -base $instance/$testfolder/$page_name $extra_url_parameter]] + acs::test::reply_has_status_code $d 200 + + set response [dict get $d body] + acs::test::dom_html root $response { + set f_id [::xowiki::test::get_object_name $root] + set CSSclass [::xowiki::test::get_form_CSSclass $root] + aa_true "page_name '$f_id' non empty" {$f_id ne ""} + aa_true "CSSclass: '$CSSclass' non empty" {$CSSclass ne ""} + set id_part [string map {: _} $page_name] + set input1 [$root getElementById F.$id_part.txt.1] + set input2 [$root getElementById F.$id_part.txt.2] + aa_equals "input1 (1st element of repeated field)" [$input1 getAttribute value] t1 + aa_equals "input2 (2nd element of repeated field)" "" "" + } + + ################################################################################ + aa_section "Edit an instance $page_name of $form_name to add 2nd repeated field" + ################################################################################ + + ::xowiki::test::edit_form_page \ + -last_request $request_info \ + -instance $instance \ + -path $testfolder/$page_name \ + -update [subst { + _title "edited $page_name" + txt.2 t2 + }] + + aa_log "Check content of the edited instance" + set d [acs::test::http -user_id $user_id [export_vars -base $instance/$testfolder/$page_name $extra_url_parameter]] + acs::test::reply_has_status_code $d 200 + + set response [dict get $d body] + acs::test::dom_html root $response { + set id_part [string map {: _} $page_name] + set input1 [$root getElementById F.$id_part.txt.1] + set input2 [$root getElementById F.$id_part.txt.2] + aa_equals "input1 (1st element of repeated field)" [$input1 getAttribute value] t1 + aa_equals "input2 (2nd element of repeated field)" [$input2 getAttribute value] t2 + } + + + } on error {errorMsg} { aa_true "Error msg: $errorMsg" 0 } finally {