Skip to content

Commit

Permalink
fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mallardduck committed Oct 17, 2022
1 parent fcdd93d commit 2d77cdc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"s9e/regexp-builder": "^1.4",
"spatie/emoji": "^2.3.0",
"spatie/pest-plugin-snapshots": "^1.0",
"symfony/var-dumper": "^6.1",
"wa72/htmlpagedom": "^2.0 || ^3.0"
},
"suggest": {
Expand Down
9 changes: 4 additions & 5 deletions tests/Unit/HtmlReplacerFragmentTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

use Astrotomic\Twemoji\HtmlReplacer;
use function Spatie\Snapshots\assertMatchesTextSnapshot;

it('can convert a single emoji paragraph', function () {
assertMatchesTextSnapshot(htmlReplacerPngParser("<p>πŸš€</p>"));
assertMatchesTextSnapshot(htmlReplacerPngParser('<p>πŸš€</p>'));
});

it('will not convert an emoji within HTML attributes', function () {
Expand Down Expand Up @@ -59,16 +58,16 @@
});

it('can handle text with an outer P tag', function () {
$textContent = "<p>This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding &lt;p&gt; tags enabled. πŸŽ‰</p>";
$textContent = '<p>This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding &lt;p&gt; tags enabled. πŸŽ‰</p>';
assertMatchesTextSnapshot(htmlReplacerPngParser($textContent));
});

it('can handle text without outer P tag', function () {
$textContent = "This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding &lt;p&gt; tags disabled. πŸŽ‰";
$textContent = 'This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding &lt;p&gt; tags disabled. πŸŽ‰';
assertMatchesTextSnapshot(htmlReplacerPngParser($textContent));
});

it('can handle text without outer P tag but inner HTML', function () {
$textContent = "This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding <code><p></code> tags disabled. πŸŽ‰";
$textContent = 'This is some fancy-πŸ’ƒ Markdown/WYSIWYG text with surrounding <code><p></code> tags disabled. πŸŽ‰';
assertMatchesTextSnapshot(htmlReplacerPngParser($textContent));
});
5 changes: 2 additions & 3 deletions tests/Unit/HtmlReplacerPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</html>
HTML;
$results = htmlReplacerPngParser($pageHtml);
expect($results)->toContain("5πŸš€")->not()->toContain('&#');
expect($results)->toContain('5πŸš€')->not()->toContain('&#');
assertMatchesTextSnapshot($results);
});

Expand All @@ -66,7 +66,6 @@
</html>
HTML;
$results = htmlReplacerPngParser($pageHtml);
expect($results)->toContain("5πŸš€")->not()->toContain('&#');
expect($results)->toContain('5πŸš€')->not()->toContain('&#');
assertMatchesTextSnapshot($results);
});

0 comments on commit 2d77cdc

Please sign in to comment.