1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-07 06:36:44 +02:00

tel protocol support.

This commit is contained in:
Wes Cossick
2016-06-17 18:39:18 -05:00
committed by Edward Z. Yang
parent a11aeab4a6
commit cc35c8eb8c
12 changed files with 111 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
$this->assertDef('news:rec.alt');
$this->assertDef('nntp://news.example.com/324234');
$this->assertDef('mailto:bob@example.com');
$this->assertDef('tel:+15555555555');
}
public function testIntegrationWithPercentEncoder()

View File

@@ -37,6 +37,11 @@ class HTMLPurifier_URIFilter_MakeAbsoluteTest extends HTMLPurifier_URIFilterHarn
$this->assertFiltering('mailto:bob@example.com');
}
public function testPreserveAltSchemeWithTel()
{
$this->assertFiltering('tel:+15555555555');
}
public function testFilterIgnoreHTTPSpecialCase()
{
$this->assertFiltering('http:/', 'http://example.com/');

View File

@@ -69,6 +69,14 @@ class HTMLPurifier_URIParserTest extends HTMLPurifier_Harness
);
}
public function testTelURI()
{
$this->assertParsing(
'tel:+1 (555) 555-5555',
'tel', null, null, null, '+1 (555) 555-5555', null, null
);
}
public function testIPv4Address()
{
$this->assertParsing(

View File

@@ -172,6 +172,42 @@ class HTMLPurifier_URISchemeTest extends HTMLPurifier_URIHarness
);
}
public function test_tel_strip_punctuation()
{
$this->assertValidation(
'tel:+1 (555) 555-5555', 'tel:+15555555555'
);
}
public function test_tel_regular()
{
$this->assertValidation(
'tel:+15555555555'
);
}
public function test_tel_with_extension()
{
$this->assertValidation(
'tel:+1-555-555-5555x123', 'tel:+15555555555x123'
);
}
public function test_tel_no_plus()
{
$this->assertValidation(
'tel:555-555-5555', 'tel:5555555555'
);
}
public function test_tel_strip_letters()
{
$this->assertValidation(
'tel:abcd1234',
'tel:1234'
);
}
public function test_data_png()
{
$this->assertValidation(