Sha256: bb22a271ddbe42ad3b1807800b405913594c1567329eab90c26ac9f1f93e5ad7

Contents?: true

Size: 1.46 KB

Versions: 55

Compression:

Stored size: 1.46 KB

Contents

require 'helper'

describe Temple::HTML::AttributeRemover do
  before do
    @remover = Temple::HTML::AttributeRemover.new
  end

  it 'should pass static attributes through' do
    @remover.call([:html, :tag,
      'div',
      [:html, :attrs, [:html, :attr, 'class', [:static, 'b']]],
      [:content]
    ]).should.equal [:html, :tag, "div",
                     [:multi,
                      [:html, :attr, "class", [:static, "b"]]],
                     [:content]]
  end

  it 'should check for empty dynamic attribute if it is included in :remove_empty_attrs' do
    @remover.call([:html, :tag,
      'div',
      [:html, :attrs, [:html, :attr, 'class', [:dynamic, 'b']]],
      [:content]
    ]).should.equal [:html, :tag, "div",
                    [:multi,
                      [:multi,
                       [:capture, "_temple_html_attributeremover1", [:dynamic, "b"]],
                       [:if, "!_temple_html_attributeremover1.empty?",
                        [:html, :attr, "class", [:dynamic, "_temple_html_attributeremover1"]]]]],
                     [:content]]
  end

  it 'should not check for empty dynamic attribute if it is not included in :remove_empty_attrs' do
    @remover.call([:html, :tag,
      'div',
      [:html, :attrs, [:html, :attr, 'name', [:dynamic, 'b']]],
      [:content]
    ]).should.equal [:html, :tag, "div",
                     [:multi,
                      [:html, :attr, "name", [:dynamic, "b"]]],
                     [:content]]
  end
end

Version data entries

55 entries across 55 versions & 6 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/html/test_attribute_remover.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/html/test_attribute_remover.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/html/test_attribute_remover.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/temple-0.8.2/test/html/test_attribute_remover.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/temple-0.8.2/test/html/test_attribute_remover.rb
temple-0.9.0 test/html/test_attribute_remover.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/test/html/test_attribute_remover.rb
temple-0.8.2 test/html/test_attribute_remover.rb
temple-0.8.1 test/html/test_attribute_remover.rb
brakeman-4.3.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/html/test_attribute_remover.rb