Skip to content

Commit

Permalink
Merge pull request #2843 from AlchemyCMS/headline-size-select
Browse files Browse the repository at this point in the history
Allow to customize Headline Sizes
  • Loading branch information
tvdeyen authored Apr 18, 2024
2 parents 5f1790c + c03285b commit dfcb1c8
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 dfcb1c8

Please sign in to comment.