From aaa3bfa6023352b4ed225bf5249fcd87f2d05365 Mon Sep 17 00:00:00 2001 From: oudwins Date: Sun, 7 Jul 2024 16:14:26 +0200 Subject: [PATCH] test: test cases for bug --- pkg/twmerge/validators_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pkg/twmerge/validators_test.go diff --git a/pkg/twmerge/validators_test.go b/pkg/twmerge/validators_test.go new file mode 100644 index 0000000..c521c0f --- /dev/null +++ b/pkg/twmerge/validators_test.go @@ -0,0 +1,23 @@ +package twmerge + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestArbitraryShadow(t *testing.T) { + assert.Equal(t, IsArbitraryShadow("[inset_0_1px_0,inset_0_-1px_0]"), true) + assert.Equal(t, IsArbitraryShadow("[0_35px_60px_-15px_rgba(0,0,0,0.3)]"), true) + assert.Equal(t, IsArbitraryShadow("[inset_0_1px_0,inset_0_-1px_0]"), true) + assert.Equal(t, IsArbitraryShadow("[0_0_#00f]"), true) + assert.Equal(t, IsArbitraryShadow("[.5rem_0_rgba(5,5,5,5)]"), true) + assert.Equal(t, IsArbitraryShadow("[-.5rem_0_#123456]"), true) + assert.Equal(t, IsArbitraryShadow("[0.5rem_-0_#123456]"), true) + assert.Equal(t, IsArbitraryShadow("[0.5rem_-0.005vh_#123456]"), true) + assert.Equal(t, IsArbitraryShadow("[0.5rem_-0.005vh]"), true) + + assert.Equal(t, IsArbitraryShadow("[rgba(5,5,5,5)]"), false) + assert.Equal(t, IsArbitraryShadow("[#00f]"), false) + assert.Equal(t, IsArbitraryShadow("[something-else]"), false) +}