Added a new method to WebGUI::HTML called makeParameter safe. It will
encode commas and single quotes to make the output safe to embed inside of a macro. Added tests to verify that it works correctly. Updated the c_companyName macro to use makeParameterSafe. Added tests to verify that the changed macro works okay. Updated the c_companyName documentation. Added a blurb to the gotchas file to cover the change to the macro.
This commit is contained in:
parent
52a3023b09
commit
76585a1daa
7 changed files with 63 additions and 10 deletions
20
t/HTML.t
20
t/HTML.t
|
|
@ -83,7 +83,20 @@ my @filterSets = (
|
|||
},
|
||||
);
|
||||
|
||||
my $numTests = scalar @filterSets;
|
||||
my @macroParamSets = (
|
||||
{
|
||||
inputText => q|,|,
|
||||
output => q|,|,
|
||||
comment => 'single comma',
|
||||
},
|
||||
{
|
||||
inputText => q|'|,
|
||||
output => q|"|,
|
||||
comment => 'single quote',
|
||||
},
|
||||
);
|
||||
|
||||
my $numTests = scalar @filterSets + scalar @macroParamSets;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
|
|
@ -91,3 +104,8 @@ foreach my $testSet (@filterSets) {
|
|||
my $output = WebGUI::HTML::filter($testSet->{inputText}, $testSet->{type});
|
||||
is($output, $testSet->{output}, $testSet->{comment});
|
||||
}
|
||||
|
||||
foreach my $testSet (@macroParamSets) {
|
||||
WebGUI::HTML::makeParameterSafe(\$testSet->{inputText});
|
||||
is($testSet->{inputText}, $testSet->{output}, $testSet->{comment});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue