8000 Fixed language detection to support parsing of HTML fragments by jkphl · Pull Request #121 · microformats/php-mf2 · GitHub
[go: up one dir, main page]

Skip to content

Fixed language detection to support parsing of HTML fragments #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test for HTML fragment language testing (#121)
  • Loading branch information
jkphl committed May 26, 2017
commit acda009e80c4245028e8a42b5c821171fab64644
12 changes: 12 additions & 0 deletions tests/Mf2/ParseLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ public function testHtmlAndHEntryLang()
$this->assertEquals('es', $result['items'][0]['properties']['html-lang']);
} # end method testHtmlAndHEntryLang()

/**
* Test HTML fragment with only h-entry lang
*/
public function testFragmentHEntryLangOnly()
{
$input = '<div class="h-entry" lang="en">This test is in English.</div>';
$parser = new Parser($input);
$result = $parser->parse();

$this->assertEquals('en', $result['items'][0]['properties']['html-lang']);
} # end method testFragmentHEntryLangOnly()

/**
* Test with different <html lang>, h-entry lang, and h-entry without lang,
* which should inherit from the <html lang>
Expand Down
0