Skip to content

Commit

Permalink
Add extra test case
Browse files Browse the repository at this point in the history
  • Loading branch information
slang25 authored and patriksvensson committed Feb 25, 2024
1 parent 277b4e7 commit f63dfba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/Spectre.Console.Tests/Unit/HighlightTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit f63dfba

Please sign in to comment.