Bugzilla – Attachment 164209 Details for
Bug 36328
C4::Scrubber should allow more HTML tags
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36328: (QA follow-up) Expand tests and reorder elements to clarify differences
Bug-36328-QA-follow-up-Expand-tests-and-reorder-el.patch (text/plain), 3.05 KB, created by
Nick Clemens (kidclamp)
on 2024-04-01 16:11:45 UTC
(
hide
)
Description:
Bug 36328: (QA follow-up) Expand tests and reorder elements to clarify differences
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-04-01 16:11:45 UTC
Size:
3.05 KB
patch
obsolete
>From eea3498d4cba877667724c4be167aa368d093001 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 1 Apr 2024 16:03:37 +0000 >Subject: [PATCH] Bug 36328: (QA follow-up) Expand tests and reorder elements > to clarify differences > >Also tidy > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Scrubber.pm | 12 ++++++------ > t/Scrubber.t | 12 ++++++++++-- > 2 files changed, 16 insertions(+), 8 deletions(-) > >diff --git a/C4/Scrubber.pm b/C4/Scrubber.pm >index e265c8dcc0c..ccfa830585d 100644 >--- a/C4/Scrubber.pm >+++ b/C4/Scrubber.pm >@@ -27,10 +27,10 @@ use HTML::Scrubber; > use C4::Context; > > my %scrubbertypes = ( >- default => {}, # place holder, default settings are below as fallbacks in call to constructor >- tag => {}, # uses defaults >+ default => {}, # place holder, default settings are below as fallbacks in call to constructor >+ tag => {}, # uses defaults > comment => { allow => [qw( br b i em big small strong )], }, >- note => { allow => [qw[ p b i u hr br em big small strong span div ]] }, >+ note => { allow => [qw[ br b i em big small strong u hr span div p ]] }, > staff => { > default => [ 1 => { '*' => 1 } ], > comment => 1, >@@ -46,11 +46,11 @@ sub new { > } > my $settings = $scrubbertypes{$type}; > my $scrubber = HTML::Scrubber->new( >- allow => exists $settings->{allow} ? $settings->{allow} : [], >- rules => exists $settings->{rules} ? $settings->{rules} : [], >+ allow => exists $settings->{allow} ? $settings->{allow} : [], >+ rules => exists $settings->{rules} ? $settings->{rules} : [], > default => exists $settings->{default} ? $settings->{default} : [ 0 => { '*' => 0 } ], > comment => exists $settings->{comment} ? $settings->{comment} : 0, >- note => exists $settings->{note} ? $settings->{note} : 0, >+ note => exists $settings->{note} ? $settings->{note} : 0, > process => 0, > ); > return $scrubber; >diff --git a/t/Scrubber.t b/t/Scrubber.t >index 3a43522ad02..e04fd2e0d94 100755 >--- a/t/Scrubber.t >+++ b/t/Scrubber.t >@@ -3,7 +3,7 @@ > use Modern::Perl; > > $| = 1; >-use Test::More tests => 30; >+use Test::More tests => 31; > use Test::Warn; > > BEGIN { >@@ -82,4 +82,12 @@ if ($@) { > pass("Test should have failed on entry of 'Client' and it did. YAY!"); > } > >-is( C4::Scrubber->new('note')->scrub('<span>Allow span</span>'), '<span>Allow span</span>' ); >+my $scrub_text = >+ '<div><span><p><b>bold</b><i>ital</i><em>emphatic</em><big>embiggen</big><small>shrink</small><strong>strongbad</strong><br><u>under</u><hr></p></span></div>'; >+my $scrub_comment = >+ '<b>bold</b><i>ital</i><em>emphatic</em><big>embiggen</big><small>shrink</small><strong>strongbad</strong><br>under'; >+is( C4::Scrubber->new('comment')->scrub($scrub_text), $scrub_comment, "Comment scrubber removes expected elements" ); >+is( >+ C4::Scrubber->new('note')->scrub($scrub_text), $scrub_text, >+ "Note scrubber removes (additional) expected elements" >+); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36328
:
163192
|
163193
|
163497
|
163582
|
163583
|
163584
|
164206
|
164207
|
164208
| 164209