Skip to content

Commit

Permalink
Add more test for style variants inheritance
Browse files Browse the repository at this point in the history
This test shows that all variants are lost when a subcomponent tries to overwrite a single variant
  • Loading branch information
omarluq committed Nov 25, 2024
1 parent 97c97de commit 1a1ecc6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/cases/style_variants_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ class SubComponent < Component
}
end

style :component do
variants {
size {
lg { %w[text-larger] }
}
}
end

attr_reader :mode

def initialize(mode: :light, **parent_opts)
Expand All @@ -94,7 +102,12 @@ def test_inheritance

render_inline(component)

assert_css "div.secondary-color.secondary-bg.text-lg"
# this fails, the SubComponent lost all variants when it tried to only overwrite the size variant
assert_css "div.secondary-color.secondary-bg.text-larger"
assert_no_css "div.secondary-color.secondary-bg.text-larger"

# this on the other hand passes
assert_css "div.text-larger"

assert_css "a.text-white"

Expand Down

0 comments on commit 1a1ecc6

Please sign in to comment.