Preserve WooCommerce HTML in product descriptions with a rich text editor.
Deploy Ladill Woo Manager / deploy (push) Successful in 1m16s

Stop stripping tags on sync so paragraphs and bold book titles round-trip to Woo.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-07 00:47:01 +00:00
co-authored by Cursor
parent 085645fd0f
commit 551473f8e5
10 changed files with 192 additions and 19 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Tests\Unit;
use App\Support\WooHtml;
use PHPUnit\Framework\TestCase;
class WooHtmlTest extends TestCase
{
public function test_sanitize_preserves_paragraphs_and_bold(): void
{
$html = '<p>Intro</p><p>In <strong>In Jail In My Own Society</strong>, author writes.</p>';
$this->assertSame(
'<p>Intro</p><p>In <strong>In Jail In My Own Society</strong>, author writes.</p>',
WooHtml::sanitize($html),
);
}
public function test_plain_to_html_wraps_legacy_paragraphs(): void
{
$plain = "First paragraph\r\nSecond paragraph\r\nThird paragraph";
$this->assertSame(
'<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p>',
WooHtml::plainToHtml($plain),
);
}
public function test_normalize_for_editor_upgrades_plain_text(): void
{
$this->assertSame(
'<p>Line one</p><p>Line two</p>',
WooHtml::normalizeForEditor("Line one\nLine two"),
);
}
}