From 983f063d33efbf2c6fb43c3aa12562b464b2cb9c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 6 Feb 2024 16:23:39 +0100 Subject: Fix image with alt text for html/md to bbcode --- tests/unit/includes/BBCodeTest.php | 46 ++++++++++++++++++++++++++++++++++++ tests/unit/includes/MarkdownTest.php | 4 ++++ 2 files changed, 50 insertions(+) create mode 100644 tests/unit/includes/BBCodeTest.php (limited to 'tests') diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php new file mode 100644 index 000000000..9e9b1a33b --- /dev/null +++ b/tests/unit/includes/BBCodeTest.php @@ -0,0 +1,46 @@ +assertEquals($expected, html2bbcode($src)); + } + + private function html2bbcode_provider(): array { + return [ + 'image with alt text' => [ + 'Alt text', + '[img=https://example.com/image.jpg]Alt text[/img]' + ], + ]; + } +} diff --git a/tests/unit/includes/MarkdownTest.php b/tests/unit/includes/MarkdownTest.php index 71f13cdb0..e05cec6fb 100644 --- a/tests/unit/includes/MarkdownTest.php +++ b/tests/unit/includes/MarkdownTest.php @@ -65,6 +65,10 @@ class MarkdownTest extends UnitTestCase { '[img=https://example.com/image.jpg]https://example.com/image.jpg[/img]', '![](https://example.com/image.jpg)' ], + 'inline image with alt text' => [ + '[img=https://example.com/image.jpg]Alt text[/img]', + '![Alt text](https://example.com/image.jpg)' + ], ]; } -- cgit v1.2.3