From 6222a9d92e1cbaae2451085eb9bdff432db198af Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sat, 30 Dec 2023 17:38:39 +0000 Subject: [PATCH] Add extra test case --- test/Spectre.Console.Tests/Unit/HighlightTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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() {