diff --git a/test/Spectre.Console.Tests/Unit/HighlightTests.cs b/test/Spectre.Console.Tests/Unit/HighlightTests.cs index 800e99ec9..6575ddfd6 100644 --- a/test/Spectre.Console.Tests/Unit/HighlightTests.cs +++ b/test/Spectre.Console.Tests/Unit/HighlightTests.cs @@ -51,6 +51,21 @@ public void Should_Not_Match_Text_Across_Tokens() result.ShouldBe(value); } + [Fact] + public void Should_Highlight_Only_First_Matched_Text() + { + // Given + var value = "Sample text with test word"; + var searchText = "te"; + var highlightStyle = _highlightStyle; + + // When + var result = value.Highlight(searchText, highlightStyle); + + // Then + result.ShouldBe("Sample [bold on yellow]te[/]xt with test word"); + } + [Fact] public void Should_Not_Match_Text_Outside_Of_Text_Tokens() {