[Rt-commit] rt branch, 4.0/make-clicky-punctuation, created. rt-4.0.12-12-g86609b8

Thomas Sibley trs at bestpractical.com
Tue May 14 18:25:56 EDT 2013


The branch, 4.0/make-clicky-punctuation has been created
        at  86609b80d0b3f1b2c890070e27ad880de8d0132f (commit)

- Log -----------------------------------------------------------------
commit 86609b80d0b3f1b2c890070e27ad880de8d0132f
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue May 14 12:51:44 2013 -0700

    Failing tests showing MakeClicky incorrectly includes trailing punctuation

diff --git a/t/data/plugins/MakeClicky/html/makeclicky b/t/data/plugins/MakeClicky/html/makeclicky
new file mode 100644
index 0000000..aef660f
--- /dev/null
+++ b/t/data/plugins/MakeClicky/html/makeclicky
@@ -0,0 +1,8 @@
+<%args>
+$content => ""
+</%args>
+<%init>
+$m->comp("/Elements/MakeClicky", content => \$content);
+$m->out($content);
+$m->abort;
+</%init>
diff --git a/t/data/plugins/MakeClicky/lib/MakeClicky.pm b/t/data/plugins/MakeClicky/lib/MakeClicky.pm
new file mode 100644
index 0000000..c09f55b
--- /dev/null
+++ b/t/data/plugins/MakeClicky/lib/MakeClicky.pm
@@ -0,0 +1,2 @@
+package MakeClicky;
+1;
diff --git a/t/web/make-clicky.t b/t/web/make-clicky.t
new file mode 100644
index 0000000..cb56063
--- /dev/null
+++ b/t/web/make-clicky.t
@@ -0,0 +1,46 @@
+use strict;
+use warnings;
+
+use RT::Test
+    tests   => 'no_declare',
+    plugins => ["MakeClicky"],
+    config  => 'Set( @Active_MakeClicky => "httpurl_overwrite" );';
+
+use Test::LongString;
+
+my ($base, $m) = RT::Test->started_ok;
+$m->login;
+$m->get_ok("/");
+
+diag "Trailing punctuation";
+{
+    my $url = 'http://bestpractical.com/rt';
+    for my $punc (qw( . ! ? ), ",") {
+        is_string(
+            make_clicky($m, "Refer to $url$punc  A following sentence."),
+            qq[Refer to <span class="clickylink"><a target="new" href="$url">$url</a></span>$punc  A following sentence.],
+            "$punc not included in url",
+        );
+    }
+}
+
+diag "Punctuation as part of the url";
+{
+    my $url = 'http://bestpractical.com/rt/download.html?foo=bar,baz&bat=1.2';
+    is_string(
+        make_clicky($m, "Refer to $url.  A following sentence."),
+        qq[Refer to <span class="clickylink"><a target="new" href="$url">$url</a></span>.  A following sentence.],
+        "Punctuation in middle of URL",
+    );
+}
+
+sub make_clicky {
+    my $m    = shift;
+    my $text = shift;
+    RT::Interface::Web::EscapeURI(\$text);
+    $m->get_ok("/makeclicky?content=$text", "made clicky")
+        or diag $m->status;
+    return $m->success ? $m->content : "";
+}
+
+1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list