Skip to content

Commit

Permalink
Avoid the newline after <textarea> tag to make WWW::Mechanize happy
Browse files Browse the repository at this point in the history
Like the removed $TODO says: WWW::Mechanize doesn't strip newline following
<textarea> tag like browsers do.
  • Loading branch information
sunnavy committed Feb 9, 2024
1 parent 5d9e605 commit f0f258c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
6 changes: 2 additions & 4 deletions share/html/Admin/Elements/ModifyTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,15 @@
<&|/l&>Headers</&>:
</div>
<div class="value col-8">
<textarea name="Headers" class="form-control" rows="10" cols="80" wrap="soft">
<%$Headers||''%></textarea>
<textarea name="Headers" class="form-control" rows="10" cols="80" wrap="soft"><%$Headers||''%></textarea>
</div>
</div>
<div class="form-row">
<div class="label col-2">
<&|/l&>Body</&>:
</div>
<div class="value col-8">
<textarea name="Body" class="form-control" rows="25" cols="80" wrap="soft">
<%$Body||''%></textarea>
<textarea name="Body" class="form-control" rows="25" cols="80" wrap="soft"><%$Body||''%></textarea>
</div>
</div>
</&>
Expand Down
16 changes: 2 additions & 14 deletions t/web/template.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ is($m->value('Type'), 'Perl', 'now that we have ExecuteCode we can update Type t
my $headers = $m->value('Headers');
my $body = $m->value('Body');

TODO: {

local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
# this test fails because earlier tests add newlines when using Mech
like($headers, qr/^Subject: Resolved/, 'got expected Content');

}
like($headers, qr/^Subject: Resolved/, 'got expected Content');

$m->field(Body => "$body\n\n\n$body");
$m->submit;
Expand All @@ -81,12 +75,6 @@ is($m->value('Type'), 'Perl', 'now that we have ExecuteCode we can update Type t
$m->form_name('ModifyTemplate');
$m->submit;

TODO: {

local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
# this test fails because the template change makes Mech continuously add newlines where browsers dont
$m->content_unlike(qr{Template \d+: Content updated});

}
$m->content_unlike(qr{Template \d+: Content updated});
}

0 comments on commit f0f258c

Please sign in to comment.