From 80a13f868bce6d400bdce20a25cf8cee16579a5a Mon Sep 17 00:00:00 2001 From: David Alejandro <15317732+davidalejandroaguilar@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:36:13 +0200 Subject: [PATCH] Allow using :skeleton as a modifier --- lib/phlexy_ui/base.rb | 1 + spec/lib/phlexy_ui/button_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/phlexy_ui/base.rb b/lib/phlexy_ui/base.rb index b876590..e85f5e9 100644 --- a/lib/phlexy_ui/base.rb +++ b/lib/phlexy_ui/base.rb @@ -24,6 +24,7 @@ def register_modifiers(modifiers) def modifiers { + skeleton: :skeleton, **self.class.modifiers, **PhlexyUI.configuration.modifiers.for(component: self.class), **PhlexyUI.configuration.modifiers.for(component: nil) diff --git a/spec/lib/phlexy_ui/button_spec.rb b/spec/lib/phlexy_ui/button_spec.rb index 955d1ee..d636911 100644 --- a/spec/lib/phlexy_ui/button_spec.rb +++ b/spec/lib/phlexy_ui/button_spec.rb @@ -233,6 +233,20 @@ expect(output).to eq(expected_html) end + context "when using the :skeleton modifier" do + subject(:output) do + render described_class.new(:neutral, :skeleton) + end + + it "renders it correctly" do + expected_html = html <<~HTML + + HTML + + expect(output).to eq(expected_html) + end + end + # TODO: Not needed once Phlex 2.0 is released. context "when passing malicious code via the block" do subject(:output) do