Skip to content

Commit

Permalink
Allow using :skeleton as a modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalejandroaguilar committed Oct 25, 2024
1 parent a523da7 commit 80a13f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/phlexy_ui/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions spec/lib/phlexy_ui/button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
<button class="btn btn-neutral skeleton"></button>
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
Expand Down

0 comments on commit 80a13f8

Please sign in to comment.