Commit 9a12cce0 authored by Ben Roberts's avatar Ben Roberts

adding tests to validate update

parent ccb63204
......@@ -129,6 +129,7 @@ class ParserTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('<dt>', $output['items'][0]['properties']['published'][0]);
$this->assertEquals('<u>', $output['items'][0]['properties']['url'][0]);
}
public function testHtmlEncodesImpliedProperties() {
$input = '<a class="h-card" href="&lt;url&gt;"><img src="&lt;img&gt;" />&lt;name&gt;</a>';
......@@ -257,4 +258,31 @@ EOT;
$result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant');
$this->assertEquals('It is a strange thing to see a five legged elephant', $result['items'][0]['properties']['content'][0]['value']);
}
// parser not respecting not[h-*] in rule "else if .h-x>a[href]:only-of-type:not[.h-*] then use that [href] for url"
public function testNotImpliedUrlFromHCard() {
$input = '<span class="h-entry">
<a class="h-card" href="http://test.com">John Q</a>
</span>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertArrayNotHasKey('url', $output['items'][0]['properties']);
}
public function testAreaTag() {
$input = '<div class="h-entry">
<area class="p-category h-card" href="http://personB.example.com" alt="Person Bee" shape="rect" coords="100,100,120,120">
</div>';
$parser = new Parser($input);
$output = $parser->parse();
$this->assertEquals('', $output['items'][0]['properties']['name'][0]);
$this->assertEquals('rect', $output['items'][0]['properties']['category'][0]['shape']);
$this->assertEquals('100,100,120,120', $output['items'][0]['properties']['category'][0]['coords']);
$this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment