-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from desmondinho/feat/merge-nullable
feat: improve nullability support
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace TailwindMerge.Tests; | ||
|
||
public class TwMergeTests | ||
{ | ||
[Theory] | ||
[InlineData( "mix-blend-normal mix-blend-multiply", "mix-blend-multiply" )] | ||
[InlineData( "h-10 h-min", "h-min" )] | ||
[InlineData( "stroke-black stroke-1", "stroke-black stroke-1" )] | ||
[InlineData( "stroke-2 stroke-[3]", "stroke-[3]" )] | ||
[InlineData( "outline-black outline-1", "outline-black outline-1" )] | ||
[InlineData( "grayscale-0 grayscale-[50%]", "grayscale-[50%]" )] | ||
[InlineData( "grow grow-[2]", "grow-[2]" )] | ||
[InlineData( "", null )] | ||
[InlineData( null, null )] | ||
public void Merge_MergesCorrectly( string classList, string expected ) | ||
{ | ||
// Act | ||
var actual = new TwMerge().Merge( classList ); | ||
|
||
// Assert | ||
Assert.Equal( expected, actual ); | ||
} | ||
|
||
[Fact] | ||
public void Merge_SameValues_ReturnsCachedResult() | ||
{ | ||
// Arrange | ||
var twMerge = new TwMerge(); | ||
|
||
// Act | ||
var actual = twMerge.Merge( "h-10 h-min" ); | ||
|
||
// Assert | ||
Assert.Equal( "h-min", actual ); | ||
|
||
// Act | ||
actual = twMerge.Merge( "h-10 h-min" ); | ||
|
||
// Assert | ||
Assert.Equal( "h-min", actual ); | ||
} | ||
} |