Skip to content

Commit

Permalink
Allow to customize Headline Sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Apr 18, 2024
1 parent 5f1790c commit c03285b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/models/alchemy/ingredients/headline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ def level_options
end

def size_options
sizes.map { |size| [".h#{size}", size] }
sizes.map do |size|
case size
when Array
size
else
[".h#{size}", size]
end
end
end

private
Expand Down
12 changes: 12 additions & 0 deletions spec/models/alchemy/ingredients/headline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@

it { is_expected.to eq([[".h3", 3], [".h4", 4]]) }
end

context "when two dimensional array" do
before do
expect(ingredient).to receive(:settings) do
{
sizes: [["XL", "text-xl"], ["L", "text-lg"]]
}
end
end

it { is_expected.to eq([["XL", "text-xl"], ["L", "text-lg"]]) }
end
end

describe "creating from a settings" do
Expand Down

0 comments on commit c03285b

Please sign in to comment.