-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated handling of `<br> tags in blockquotes
- Loading branch information
Showing
8 changed files
with
97 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
public/build/assets/app-BN6-1s-2.css → public/build/assets/app-BaiyHV97.css
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,7 @@ main div { | |
text-decoration: underline; | ||
} | ||
|
||
:empty { | ||
> :empty:not(br) { | ||
display: none; | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Modifications; | ||
|
||
use App\View\Modifications\BlockquoteModifier; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class BlockquoteModifierTest extends TestCase | ||
{ | ||
public function testItAddsCssClassesToBlockquoteTags(): void | ||
{ | ||
$modifier = new BlockquoteModifier(); | ||
|
||
$html = ' | ||
<blockquote>{note} This is a note.</blockquote> | ||
<blockquote><strong>Warning</strong> This is a warning.</blockquote> | ||
<blockquote>{tip} This is a tip.</blockquote> | ||
<blockquote><strong>Note</strong> This is a note.</blockquote> | ||
<blockquote>[!WARNING] This is a warning.</blockquote> | ||
<blockquote>[!NOTE] This is a tip.</blockquote> | ||
<blockquote><p><br>Более подробную документацию по использованию Vite с Laravel можно найти в нашей <a href="/docs/10.x/vite"> специализированной документации по сборке и компиляции ваших ресурсов.</a>.</p></blockquote> | ||
'; | ||
|
||
$modifiedHtml = $modifier->handle($html, function ($content) { | ||
return $content; | ||
}); | ||
|
||
$expectedResult = ' | ||
<blockquote class="docs-blockquote-note"><div> This is a note.</div></blockquote> | ||
<blockquote class="docs-blockquote-note"><div> This is a warning.</div></blockquote> | ||
<blockquote class="docs-blockquote-tip"><div> This is a tip.</div></blockquote> | ||
<blockquote class="docs-blockquote-tip"><div> This is a note.</div></blockquote> | ||
<blockquote class="docs-blockquote-note"><div> This is a warning.</div></blockquote> | ||
<blockquote class="docs-blockquote-tip"><div> This is a tip.</div></blockquote> | ||
'; | ||
|
||
// Удаляем лишние пробелы и символы новой строки для лучшего сравнения | ||
$expectedResult = preg_replace('/\s+/', '', $expectedResult); | ||
$modifiedHtml = preg_replace('/\s+/', '', $modifiedHtml); | ||
|
||
$this->assertEquals($expectedResult, $modifiedHtml); | ||
} | ||
|
||
public function testItPreservesBrTagsInBlockquotes(): void | ||
{ | ||
$modifier = new BlockquoteModifier(); | ||
|
||
$html = ' | ||
<blockquote> | ||
<p> | ||
<br> | ||
Более подробную документацию по использованию Vite с Laravel можно найти в нашей <a href="/docs/10.x/vite"> | ||
специализированной документации по сборке и компиляции ваших ресурсов.</a>. | ||
</p> | ||
</blockquote> | ||
'; | ||
|
||
$modifiedHtml = $modifier->handle($html, function ($content) { | ||
return $content; | ||
}); | ||
|
||
$expectedResult = ' | ||
<blockquote> | ||
<p> | ||
Более подробную документацию по использованию Vite с Laravel можно найти в нашей <a href="/docs/10.x/vite"> | ||
<br/>специализированной документации по сборке и компиляции ваших ресурсов.</a>. | ||
</p> | ||
</blockquote> | ||
'; | ||
|
||
$expectedResult = preg_replace('/\s+/', '', $expectedResult); | ||
$modifiedHtml = preg_replace('/\s+/', '', $modifiedHtml); | ||
|
||
$this->assertEquals($expectedResult, $modifiedHtml); | ||
} | ||
} |