Preserve WooCommerce HTML in product descriptions with a rich text editor.
Deploy Ladill Woo Manager / deploy (push) Successful in 1m16s
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:
@@ -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"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user