https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44151
Bug ID: 44151
Summary: xt/tt_tidy.t does not catch templates with
commented-out head and body tags
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Test Suite
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
Target Milestone: ---
The Koha Template Toolkit prettier plugin rewrites </head>, <body ...> and
</body> as HTML comments while it formats a template (they are unbalanced
inside a single TT file), and misc/devel/tidy.pl reverts that. A template
formatted with prettier directly (npx prettier, yarn prettier --write, editor
format-on-save) keeps the comments, so the page is served without a head or
body tag.
xt/tt_tidy.t does not catch this. It compares the file with the output of
'tidy.pl --no-write'. Prettier turns an existing <!--</head>--> into
<!--<!--</head>-->-->, tidy.pl reverts only the inner pair, so the output
equals the damaged file and the test passes. Running tidy.pl on a damaged file
does not repair it either.
The damage has reached the tree. admin/searchengine/elasticsearch/mappings.tt
has had '<!--</head>-->' and '<!--<body id="admin_searchengine_mappings"
class="admin">-->' since bug 22639, and the notices, print_notice and register
templates were damaged the same way while fixing the failing Jenkins tests.
Test plan:
1. In a template, replace '</head>' with '<!--</head>-->' and '<body ...>' with
'<!--<body ...>-->'
2. Run: prove xt/tt_tidy.t
=> Before the patch: passes, although the template is broken
3. Run: perl misc/devel/tidy.pl path/to/template.tt
=> Before the patch: the comments are still there
=> After the patch: </head> and <body ...> are restored
4. Run: prove xt/find-commented-head-body.t
=> After the patch: fails with the file name and line numbers while the
comments are present, and passes once tidy.pl has restored the tags
5. Run: prove xt/tt_tidy.t
=> After the patch: fails for the damaged template until it is tidied
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/