Skip to content

Commit

Permalink
Add extra test case
Browse files Browse the repository at this point in the history
  • Loading branch information
slang25 committed Dec 30, 2023
1 parent 34892e2 commit 6222a9d
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 6222a9d

Please sign in to comment.