mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Don't duplicate the same classes
This commit is contained in:
parent
4c9fa25e07
commit
8bf4a92907
2 changed files with 3 additions and 1 deletions
|
@ -62,7 +62,7 @@ module Hamlit
|
|||
when :id
|
||||
result[key] = [base[key], target[key]].compact.join('_')
|
||||
when :class
|
||||
result[key] = [base[key], target[key]].flatten.compact.map(&:to_s).sort.join(' ')
|
||||
result[key] = [base[key], target[key]].flatten.compact.map(&:to_s).sort.uniq.join(' ')
|
||||
end
|
||||
else
|
||||
result[key] = base[key].nil? ? target[key] : base[key]
|
||||
|
|
|
@ -124,9 +124,11 @@ describe Hamlit::Engine do
|
|||
it 'joins attribute class and element class' do
|
||||
assert_render(<<-HAML, <<-HTML, compatible_only: :haml)
|
||||
.foo{ class: ['bar'] }
|
||||
.foo{ class: ['bar', 'foo'] }
|
||||
.foo{ class: ['bar', nil] }
|
||||
.foo{ class: ['bar', 'baz'] }
|
||||
HAML
|
||||
<div class='bar foo'></div>
|
||||
<div class='bar foo'></div>
|
||||
<div class='bar foo'></div>
|
||||
<div class='bar baz foo'></div>
|
||||
|
|
Loading…
Add table
Reference in a new issue