From 2f8985607cd7f0c959a73e5c1a9a2f1dc36806cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Fri, 15 Dec 2023 19:46:32 +0100 Subject: [PATCH] Add directive test for admonition/danger --- src/Templates/default/html/directives/admonition.html.twig | 4 ++-- tests/IntegrationTest.php | 4 ++++ tests/fixtures/expected/blocks/directives/caution.html | 2 +- tests/fixtures/expected/blocks/directives/danger.html | 6 ++++++ tests/fixtures/expected/main/datetime.html | 4 +--- tests/fixtures/source/blocks/directives/danger.rst | 4 ++++ 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 tests/fixtures/expected/blocks/directives/danger.html create mode 100644 tests/fixtures/source/blocks/directives/danger.rst diff --git a/src/Templates/default/html/directives/admonition.html.twig b/src/Templates/default/html/directives/admonition.html.twig index f32f3275..9fb03270 100644 --- a/src/Templates/default/html/directives/admonition.html.twig +++ b/src/Templates/default/html/directives/admonition.html.twig @@ -5,9 +5,9 @@ {% elseif name in ['hint', 'tip'] %} - {% elseif name in ['attention', 'important', 'warning'] %} + {% elseif name in ['attention', 'caution', 'important', 'warning'] %} - {% elseif name in ['caution', 'danger', 'error'] %} + {% elseif name in ['danger', 'error'] %} {% elseif name in ['versionadded', 'deprecated'] %} {# don't show an icon for these directives #} diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 5e3cfa03..cf34cde0 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -158,6 +158,10 @@ public function parserUnitBlockProvider() 'blockName' => 'directives/admonition', ]; + yield 'danger' => [ + 'blockName' => 'directives/danger', + ]; + yield 'note-code-block-nested' => [ 'blockName' => 'directives/note-code-block-nested', ]; diff --git a/tests/fixtures/expected/blocks/directives/caution.html b/tests/fixtures/expected/blocks/directives/caution.html index 500ba6dd..717c09f2 100644 --- a/tests/fixtures/expected/blocks/directives/caution.html +++ b/tests/fixtures/expected/blocks/directives/caution.html @@ -1,6 +1,6 @@

- + Caution

Using too many sidebars or caution directives can be distracting!

diff --git a/tests/fixtures/expected/blocks/directives/danger.html b/tests/fixtures/expected/blocks/directives/danger.html new file mode 100644 index 00000000..e4fbc9aa --- /dev/null +++ b/tests/fixtures/expected/blocks/directives/danger.html @@ -0,0 +1,6 @@ +
+

+ + Danger +

This message is about security risk or data integrity threat.

+
diff --git a/tests/fixtures/expected/main/datetime.html b/tests/fixtures/expected/main/datetime.html index c3026372..c1ea0890 100644 --- a/tests/fixtures/expected/main/datetime.html +++ b/tests/fixtures/expected/main/datetime.html @@ -215,9 +215,7 @@

- - - + Caution

Using too many sidebars or caution directives can be distracting!

diff --git a/tests/fixtures/source/blocks/directives/danger.rst b/tests/fixtures/source/blocks/directives/danger.rst new file mode 100644 index 00000000..dfc42179 --- /dev/null +++ b/tests/fixtures/source/blocks/directives/danger.rst @@ -0,0 +1,4 @@ + +.. danger:: + + This message is about security risk or data integrity threat.