Skip to content

Commit 6172c6a

Browse files
committed
test: Add test when base param is a string
1 parent 6025822 commit 6172c6a

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

lib/cva/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Helper
1717
# This data is shared through the class and
1818
# can be accessed to build variant-specific class names dynamically.
1919
#
20-
# @param base [Array<String>] Base class names applied to the object/component.
20+
# @param base [Array<String> | String] Base class names applied to the object/component.
2121
# @param schema [Hash] Schema for defining variants, default variants, and compound variants.
2222
#
2323
# @return [void]

test/cva/test_cva_helper.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ def test_when_schema_structure_invalid # rubocop:disable Metrics
7373
end
7474

7575
def test_schema_with_variants
76-
self.class.cva(
77-
["px-4 py-2", "bg-red-100"],
78-
{ variants: { size: { medium: "text-base", small: "text-sm" } } }
79-
)
76+
self.class.cva("px-4 py-2 bg-red-100",
77+
{ variants: { size: { medium: "text-base", small: "text-sm" } } })
8078

8179
assert_equal "px-4 py-2 bg-red-100 text-base", self.class.variants({ size: :medium })
8280
assert_equal "px-4 py-2 bg-red-100 text-sm", self.class.variants({ size: :small })

test/cva/test_integration_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TestIntegrationHelper < ActionView::TestCase
99
include RenderERBUtils
1010

1111
cva(
12-
["px-4 py-2", "bg-red-100"],
12+
"px-4 py-2 bg-red-100",
1313
{
1414
variants: { size: { medium: "text-base", small: "text-sm", large: "text-xl" },
1515
color: { red: "text-red-100" } },

0 commit comments

Comments
 (0)