Skip to content

Commit 2c23283

Browse files
committed
Add tests.
1 parent 14e829e commit 2c23283

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/ShortenTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,22 @@ public function testTruncatesMarkupWithHeadingTags(): void
106106
$shorten->truncateMarkup('<h1>Example Heading</h1>', 7)
107107
);
108108
}
109+
110+
public function testTruncatesMarkupWithDelimiterInTag(): void
111+
{
112+
$shorten = new Shorten();
113+
$this->assertEquals(
114+
'Hello world <a href="#" rel="nofollow">li...</a>',
115+
$shorten->truncateMarkup('Hello world <a href="#" rel="nofollow">link</a>', 14, '...', true, false)
116+
);
117+
}
118+
119+
public function testTruncatesMarkupWithDelimiterInTagWordSafe(): void
120+
{
121+
$shorten = new Shorten();
122+
$this->assertEquals(
123+
'Hello world...',
124+
$shorten->truncateMarkup('Hello world <a href="#" rel="nofollow">link</a>', 14, '...', true, true)
125+
);
126+
}
109127
}

0 commit comments

Comments
 (0)