http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13941 --- Comment #24 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Frédéric Demians from comment #23)
(In reply to Jonathan Druart from comment #22)
Comment on attachment 37781 [details] [review] [review] [Signed-off] Bug 13941 [1/2] Test <body> tag with id/class attributes
Review of attachment 37781 [details] [review] [review]: -----------------------------------------------------------------
::: xt/tt_valid.t @@ +55,5 @@
+ description => '<body> tag with id and class attributes', + check => sub { + my ($self, $name, $token) = @_; + return if $name =~ /bodytag\.inc/; + $_ = $token->{_string};
Sorry but I still don't understand why this is useful.
The sub complete code is:
my ($self, $name, $token) = @_; return if $name =~ /bodytag\.inc/; $_ = $token->{_string}; push @{$self->{errors}->{$name}}, $token->{_lc} if /^<body/ && ! /id=".+"/ && ! /class=".+"/;
The $_ is used in the last line which should have been coded like that without $_ assignation:
if $token->{_string} =~ $/^<body/ && ! $token->{_string} =~ /id=".+"/ && ! $token->{_string} =~ /class=".+"/;
Hope this explanation doesn't obfuscate more something which isn't already that clear.
Sorry, read to quickly the push statement. I personally think it's a bad idea to assign the default variable, but I don't want to impose that. Without the second patch applied, I get: % prove xt/tt_valid.t xt/tt_valid.t .. Can't use string ("</head>") as a HASH ref while "strict refs" in use at xt/tt_valid.t line 60. # Looks like your test exited with 255 before it could output anything. xt/tt_valid.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 3/3 subtests Test Summary Report ------------------- xt/tt_valid.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 3 tests but ran 0. Files=1, Tests=0, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.10 cusr 0.00 csys = 0.12 CPU) Result: FAIL If I apply the second one, and remove an id from a body tag: % git diff diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt index 74bedcb..ffd1c1b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -123,7 +123,7 @@ function submitForm(form) { //]]> </script> </head> -<body id="acq_basketgroup" class="acq"> +<body class="acq"> [% INCLUDE 'header.inc' %] [% INCLUDE 'acquisitions-search.inc' %] % prove xt/tt_valid.t xt/tt_valid.t .. ok All tests successful. Files=1, Tests=3, 2 wallclock secs ( 0.02 usr 0.00 sys + 2.76 cusr 0.00 csys = 2.78 CPU) Result: PASS Shouldn't it fail? -- You are receiving this mail because: You are watching all bug changes.