Skip to content
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

Add tests for direction #4

Merged
merged 3 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Github PHPStan](https://img.shields.io/github/actions/workflow/status/the-3labs-team/laravel-readability/phpstan.yml?branch=main&label=phpstan&style=flat-square)](https://github.com/the-3labs-team/laravel-readability/actions?query=workflow%3Aphpstan+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/the-3labs-team/laravel-readability/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/the-3labs-team/laravel-readability/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Maintainability](https://api.codeclimate.com/v1/badges/0fcf8cc60952fcc6d286/maintainability)](https://codeclimate.com/github/The-3Labs-Team/laravel-readability/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/0fcf8cc60952fcc6d286/test_coverage)](https://codeclimate.com/github/The-3Labs-Team/laravel-readability/test_coverage)
![License Mit](https://img.shields.io/github/license/murdercode/laravel-shortcode-plus)
[![Total Downloads](https://img.shields.io/packagist/dt/the-3labs-team/laravel-readability.svg?style=flat-square)](https://packagist.org/packages/the-3labs-team/laravel-readability)

Expand Down
6 changes: 6 additions & 0 deletions tests/ReadabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
->and($images)->toContain('/static/img/bitcoin/privacy.svg');
});

it('can parse and get the direction', function () {
$html = file_get_contents(__DIR__.'/fixtures/demo.html');
$direction = Readability::parse($html)->getDirection();
expect($direction)->toBe('ltr');
});

it('can parse and get the content', function () {
$html = file_get_contents(__DIR__.'/fixtures/demo.html');
$readability = Readability::parse($html);
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h4>October 31, 2008</h4>


</div>
<div id="CONTENT" class="doc-content"><h2 id="abstract"><a href="#abstract">Abstract</a></h2>
<div id="CONTENT" class="doc-content" dir="ltr"><h2 id="abstract"><a href="#abstract">Abstract</a></h2>

<p>A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution.

Expand Down