Skip to content

Commit 14a2bcc

Browse files
Copilotreakaleek
andcommitted
Add comprehensive tests for crosslink empty text feature
Co-authored-by: reakaleek <[email protected]>
1 parent 05547a3 commit 14a2bcc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/Elastic.Markdown.Tests/Inline/InlineLinkTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,31 @@ public void EmitsCrossLink()
189189
}
190190
}
191191

192+
public class CrossLinkEmptyTextNoTitleTest(ITestOutputHelper output) : LinkTestBase(output,
193+
"""
194+
195+
Go to [](kibana://get-started/index.md)
196+
"""
197+
)
198+
{
199+
[Fact]
200+
public void GeneratesHtml() =>
201+
// language=html - when no title is available, link text should remain empty
202+
Html.Should().Contain(
203+
"""<p>Go to <a href="https://docs-v3-preview.elastic.dev/elastic/kibana/tree/main/get-started" hx-select-oob="#main-container" preload="mousedown"></a></p>"""
204+
);
205+
206+
[Fact]
207+
public void HasNoErrors() => Collector.Diagnostics.Should().HaveCount(0);
208+
209+
[Fact]
210+
public void EmitsCrossLink()
211+
{
212+
Collector.CrossLinks.Should().HaveCount(1);
213+
Collector.CrossLinks.Should().Contain("kibana://get-started/index.md");
214+
}
215+
}
216+
192217
public class LinkWithUnresolvedInterpolationError(ITestOutputHelper output) : LinkTestBase(output,
193218
"""
194219
[global search field]({{this-variable-does-not-exist}}/introduction.html#kibana-navigation-search)

0 commit comments

Comments
 (0)