diff --git a/lib/hamlit/attribute.rb b/lib/hamlit/attribute.rb index 8bde517c..2d26058d 100644 --- a/lib/hamlit/attribute.rb +++ b/lib/hamlit/attribute.rb @@ -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] diff --git a/spec/hamlit/engine/old_attributes_spec.rb b/spec/hamlit/engine/old_attributes_spec.rb index 02026787..ed8cc8d3 100644 --- a/spec/hamlit/engine/old_attributes_spec.rb +++ b/spec/hamlit/engine/old_attributes_spec.rb @@ -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 +