Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
best-practical
rtir
Commits
1ea8f6d0
Commit
1ea8f6d0
authored
Jan 04, 2011
by
sunnavy
Browse files
allow all the 2+ letter tlds for email and test for this
Conflicts: t/015-make-clicky.t
parent
05ef4c1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
html/Callbacks/RTIR/Elements/MakeClicky/Default
html/Callbacks/RTIR/Elements/MakeClicky/Default
+1
-1
t/015-make-clicky.t
t/015-make-clicky.t
+46
-1
No files found.
html/Callbacks/RTIR/Elements/MakeClicky/Default
View file @
1ea8f6d0
...
...
@@ -201,7 +201,7 @@ my @types = (
},
{
name => "email",
regex => qr{(?:mailto:)?<?[\w\.\+-]+\@[\w\.-]+\.\w{2,
3
}>?},
regex => qr{(?:mailto:)?<?[\w\.\+-]+\@[\w\.-]+\.\w{2,}>?},
action => "email",
},
{
...
...
t/015-make-clicky.t
View file @
1ea8f6d0
...
...
@@ -3,7 +3,7 @@
use
strict
;
use
warnings
;
use
RT::IR::
Test
tests
=>
33
;
use
RT::IR::
Test
tests
=>
undef
;
RT::
Test
->
started_ok
;
my
$agent
=
default_agent
();
...
...
@@ -47,3 +47,48 @@ diag "clicky ip" if $ENV{'TEST_VERBOSE'};
ok
(
!
grep
(
lc
(
$_
->
text
||
'')
eq
'
lookup ip
',
@links
),
"
not found link
");
}
diag
"
clicky email
"
if
$ENV
{'
TEST_VERBOSE
'};
{
for
my
$email
(
'
foo@example.com
',
'
foo-bar+baz@example.me
',
'
foo@example.mobi
',
'
foo@localhost.localhost
',
)
{
diag
"
test valid email
$email
"
if
$ENV
{
TEST_VERBOSE
};
my
(
$name
,
$domain
)
=
split
/@/
,
$email
,
2
;
my
$id
=
$agent
->
create_ir
(
{
Subject
=>
'
clicky email
',
Content
=>
$email
}
);
$agent
->
display_ticket
(
$id
);
my
$email_link
=
$agent
->
find_link
(
text_regex
=>
qr/\Qlookup email\E$/
);
my
$domain_link
=
$agent
->
find_link
(
text_regex
=>
qr/^\Qlookup "$domain"\E$/
i
);
$agent
->
save_content
('
/tmp/x.html
');
if
(
$clicky
{'
email
'}
)
{
ok
(
$email_link
,
"
found link
"
);
ok
(
$email_link
->
url
=~
/(?<!\w)\Q$email\E(?!\w)/
,
'
url has an email
'
);
ok
(
$domain_link
,
"
found link
"
);
ok
(
$domain_link
->
url
=~
/(?<!\w)\Q$domain\E(?!\w)/
,
'
url has a domain
'
);
}
else
{
ok
(
!
$email_link
,
"
not found email link
"
);
ok
(
!
$domain_link
,
"
not found domain link
"
);
}
}
for
my
$email
(
'
foo@example
',
'
@example.com
',
)
{
diag
"
test invalid email
$email
"
if
$ENV
{
TEST_VERBOSE
};
my
(
$name
,
$domain
)
=
split
/@/
,
$email
,
2
;
my
$id
=
$agent
->
create_ir
(
{
Subject
=>
'
clicky email
',
Content
=>
$email
}
);
$agent
->
display_ticket
(
$id
);
my
$email_link
=
$agent
->
find_link
(
text_regex
=>
qr/\Qlookup email\E$/
);
ok
(
!
$email_link
,
"
not found email link
"
);
my
$domain_link
=
$agent
->
find_link
(
text_regex
=>
qr/^\Qlookup "$domain"\E$/
i
);
ok
(
!
$domain_link
,
"
not found domain link
"
);
}
}
done_testing
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment