test-helper-procs.tcl


Procedures in this file

Detailed information

xowf::test::question_names_from_input_form (private)

 xowf::test::question_names_from_input_form d

Parse html reply and extract question names (test-item-convention) from the form content.

Parameters:
d (required)
Returns:
list of question names

Partial Call Graph (max 5 caller/called nodes):
%3 acs::test::dom_html acs::test::dom_html (public) xowiki::test::get_content xowiki::test::get_content (public) xowf::test::question_names_from_input_form xowf::test::question_names_from_input_form xowf::test::question_names_from_input_form->acs::test::dom_html xowf::test::question_names_from_input_form->xowiki::test::get_content

Testcases:
No testcase defined.

xowf::test::require_test_instance (private)

 xowf::test::require_test_instance

Make sure the test instance is there and create it if necessary.

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) aa_export_vars aa_export_vars (public) acs::test::require_package_instance acs::test::require_package_instance (public) xowf::test::require_test_instance xowf::test::require_test_instance xowf::test::require_test_instance->_ xowf::test::require_test_instance->aa_export_vars xowf::test::require_test_instance->acs::test::require_package_instance

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

namespace eval ::xowf::test {
    ad_proc -private question_names_from_input_form {d} {

        Parse html reply and extract question names
        (test-item-convention) from the form content.

        @return list of question names
    } {
        acs::test::dom_html root [::xowiki::test::get_content $d] {
            set input_names [$root selectNodes {//input/@name}]
            lappend input_names {*}[$root selectNodes {//textarea/@name}]
            ns_log notice "TEXTAREAS [$root selectNodes {//textarea/@name}]"
        }
        ns_log notice "input_names <$input_names>"
        return [lmap input_name [lsort -unique $input_names] {
            set name [lindex [split [lindex $input_name 1] .] 0]
            if {[string match "__*" $name]} continue
            ns_log notice "... check '$name'"
            if {[string range $name end end] ne "_"} continue
            string range $name 0 end-1
        }]
    }

    ad_proc -private require_test_instance {} {
        Make sure the test instance is there and create it if necessary.
    } {
        aa_export_vars {_xowf_test_instance_name}
        set _xowf_test_instance_name /xowf-test
        ::acs::test::require_package_instance \
            -package_key xowf \
            -instance_name $_xowf_test_instance_name
    }
}
#
# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: