Skip to content

Commit 3c0b7f3

Browse files
committed
Add test
1 parent 481bf2e commit 3c0b7f3

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

tests/Elastic.Markdown.Tests/Directives/AdmonitionTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,29 @@ public void Render() => Html.Should().Contain("""
185185
</li>
186186
""");
187187
}
188+
189+
190+
public class DirectiveInList(ITestOutputHelper output) : DirectiveTest<AdmonitionBlock>(output,
191+
"""
192+
# heading
193+
194+
- List Item 1
195+
:::::{note}
196+
Hello, World!
197+
:::::
198+
"""
199+
)
200+
{
201+
[Fact]
202+
public void Type() => Block!.Admonition.Should().Be("note");
203+
204+
[Fact]
205+
public void Render() => Html.Should().Contain("""
206+
<li> List Item 1
207+
<div class="admonition note">
208+
<p class="admonition-title">Note</p>
209+
Hello, World!
210+
</div>
211+
</li>
212+
""");
213+
}

tests/Elastic.Markdown.Tests/Directives/DirectiveBaseTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public override async Task InitializeAsync()
2323
{
2424
await base.InitializeAsync();
2525
Block = Document
26-
.Where(block => block is TDirective)
27-
.Cast<TDirective>()
26+
.Descendants<TDirective>()
2827
.FirstOrDefault();
2928
}
3029

0 commit comments

Comments
 (0)