_xowiki__includelet_toc (private)

 _xowiki__includelet_toc

Defined in packages/xowiki/tcl/test/includelet-test-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_log aa_log (public) aa_log_result aa_log_result (public) aa_section aa_section (public) aa_true aa_true (public) acs::test::dom_html acs::test::dom_html (public) _xowiki__includelet_toc _xowiki__includelet_toc _xowiki__includelet_toc->aa_log _xowiki__includelet_toc->aa_log_result _xowiki__includelet_toc->aa_section _xowiki__includelet_toc->aa_true _xowiki__includelet_toc->acs::test::dom_html

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        set system_locale [lang::system::locale]
        set instance /xowiki-test
        set package_id [::acs::test::require_package_instance  -package_key xowiki  -empty  -instance_name $instance]
        try {

            ::xowiki::Package initialize -package $package_id
            set root_folder_id [::$package_id folder_id]

            lang::system::set_locale en_US
            set f_id [::xowiki::test::require_folder  "toc-folder" $root_folder_id $package_id]

            #
            # Create pages for toc testing, including page_order comparisons
            #
            foreach po {
                1
                1.1
                1.1.1
                1.10
                1.2
                10
                10.1
                100
                2
                2.1
                3
                3.1
                4
                9
            } {
                set id($po) [xowiki::test::require_page  -page_order $po  en:p$po $f_id $package_id]
            }
            ::xo::db::CrClass get_instance_from_db -item_id $id(1)

            foreach includelet {
                {toc -full 1 -decoration plain}
                {toc -style list -expand_all true -decoration plain}
                {toc -style yuitree -decoration none}
            } {
                aa_section "$includelet"

                set HTML [$id(1) include $includelet]
                #ns_log notice "R $includelet => $HTML "

                acs::test::dom_html root $HTML {
                    set elements [lmap node [$root selectNodes //li] {lindex [$node asText] 0}]
                }
                aa_log "elements: $elements"

                aa_true "find 1.1"  {[lsearch $elements 1.1] > -1}
                aa_true "find 1.2"  {[lsearch $elements 1.2] > -1}
                aa_true "find 1.10" {[lsearch $elements 1.10] > -1}
                aa_true "find 9"    {[lsearch $elements 9] > -1}
                aa_true "find 100"  {[lsearch $elements 100] > -1}

                aa_true "1.1 before 1.2"  {[lsearch $elements 1.1] < [lsearch $elements 1.2]}
                aa_true "1.2 before 1.10" {[lsearch $elements 1.2] < [lsearch $elements 1.10]}
                aa_true "3.1 before 9"    {[lsearch $elements 3.1] < [lsearch $elements 9]}
                aa_true "2 before 100"    {[lsearch $elements 2]   < [lsearch $elements 100]}
            }

        } finally {
            lang::system::set_locale $system_locale

            # set node_id [site_node::get_node_id -url /$instance]
            # site_node::unmount -node_id $node_id
            # site_node::delete -node_id $node_id -delete_package
        }
    }} {
          aa_log "Running testcase body $body_count"
          set ::__aa_test_indent [info level]
          set catch_val [catch $testcase_body msg]
          if {$catch_val != 0 && $catch_val != 2} {
              aa_log_result "fail" "includelet_toc (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: