Index: openacs-4/packages/acs-templating/tcl/test/spell-checker-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/test/spell-checker-procs.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/acs-templating/tcl/test/spell-checker-procs.tcl 19 Jul 2018 12:16:20 -0000 1.12 +++ openacs-4/packages/acs-templating/tcl/test/spell-checker-procs.tcl 22 Jul 2018 11:37:20 -0000 1.13 @@ -6,7 +6,13 @@ @cvs-id $Id$ } -aa_register_case -cats { api } spellcheck__get_element_formtext { +aa_register_case \ + -cats { api } \ + -procs { + parameter::get_from_package_key + template::util::spellcheck::get_element_formtext + } \ + spellcheck__get_element_formtext { Test the spell-check proc that does the actual spell-checking. } { @@ -50,15 +56,12 @@ aa_log "Have you installed aspell and aspell-dict-en ?" return } - aa_true "True statement: Text contains no misspelled words" {$error_num == 0} aa_log "Number of miss-spelled words found in text: $error_num" - aa_false "False statement: Text contains misspelled word(s)" {$error_num > 0} aa_equals "Number of misspelled words found in text" $error_num 0 - aa_log "Returned string: $formtext_to_display" aa_true "The returned string contains a hidden var named 'var_to_spellcheck.merge_text'" \ @@ -89,20 +92,21 @@ aa_true "True statement: Text contains misspelled words" {$error_num > 0} aa_log "Number of misspelled words found in text: $error_num" - aa_false "False statement: Text contains no misspelled word(s)" {$error_num == 0} aa_log "Returned string: $formtext_to_display" - aa_true "The returned string contains a hidden var named 'var_to_spellcheck.merge_text'" \ [regexp "var_to_spellcheck.merge_text" $formtext_to_display] aa_true "The returned string contains $error_num hidden var(s) named 'var_to_spellcheck.error_N', where N is a number between 0 and [expr {$error_num - 1}]." \ [regexp "var_to_spellcheck.error_\[0-9\]*" $formtext_to_display] - aa_equals "The number of misspelled words matches the number of error placeholders in the merge_text" [regexp -all "var_to_spellcheck.error_\[0-9\]*" $formtext_to_display] [regexp -all "\#\[0-9\]*\#" $formtext_to_display] + aa_equals "The number of misspelled words matches the number of error placeholders in the merge_text" \ + [regexp -all "var_to_spellcheck.error_\[0-9\]*" $formtext_to_display] \ + [regexp -all "\#\[0-9\]*\#" $formtext_to_display] - aa_true "just_the_errwords contains the errwords we expected: '[join $errwords ", "]'" [util_sets_equal_p $just_the_errwords $errwords] + aa_true "just_the_errwords contains the errwords we expected: '[join $errwords ", "]'" \ + [util_sets_equal_p $just_the_errwords $errwords] ##### # @@ -125,13 +129,11 @@ aa_true "True statement: HTML fragment contains no misspelled words" {$error_num == 0} aa_log "Number of miss-spelled words found in HTML fragment: $error_num" - aa_false "False statement: HTML fragment contains misspelled word(s)" {$error_num > 0} aa_equals "Number of misspelled words found in HTML fragment" $error_num 0 aa_log "Returned string: $formtext_to_display" - aa_true "The returned string contains a hidden var named 'var_to_spellcheck.merge_text'" \ [regexp "var_to_spellcheck.merge_text" $formtext_to_display] @@ -172,12 +174,19 @@ aa_true "The returned string contains hidden var(s) named 'var_to_spellcheck.error_N', where N is the error number." \ [regexp "var_to_spellcheck.error_\[0-9\]*" $formtext_to_display] - aa_true "just_the_errwords contains the errwords we expected: '[join $errwords ", "]'" [util_sets_equal_p $just_the_errwords $errwords] + aa_true "just_the_errwords contains the errwords we expected: '[join $errwords ", "]'" \ + [util_sets_equal_p $just_the_errwords $errwords] } -aa_register_case -cats { api } spellcheck__spellcheck_properties { +aa_register_case \ + -cats { api } \ + -procs { + parameter::get_from_package_key + template::util::spellcheck::spellcheck_properties + } \ + spellcheck__spellcheck_properties { Test the proc that knows if spell-checking is activated, if it should be performed, and which value the pull-down menu should default to. } { @@ -210,8 +219,10 @@ # textarea set element(widget) textarea # spellcheck conf from parameter - set spellcheck_p [expr {[info exists widget_info($element(widget))] && - [set widget_info($element(widget))]}] + set spellcheck_p [expr { + [info exists widget_info($element(widget))] + && $widget_info($element(widget)) + }] aa_log "--- Spell-checking enabled on widget \"$element(widget)\"? --- $command" array set spellcheck [{*}$command] @@ -226,8 +237,10 @@ # richtext set element(widget) richtext # spellcheck conf from parameter - set spellcheck_p [expr {[info exists widget_info($element(widget))] && - [set widget_info($element(widget))]}] + set spellcheck_p [expr { + [info exists widget_info($element(widget))] + && $widget_info($element(widget)) + }] aa_log "--- Spell-checking enabled on widget \"$element(widget)\"? --- $command" array set spellcheck [{*}$command]