Sha256: d3e1e3784f0048cad5de7e4bcb24ee7577fba79b9f1cc3514a5314c4d3e6a53c

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class FilterKwargTest < Minitest::Test
  module KwargFilter
    def html_tag(_tag, attributes)
      attributes
        .map { |key, value| "#{key}='#{value}'" }
        .join(' ')
    end
  end

  include Liquid

  def test_can_parse_data_kwargs
    with_global_filter(KwargFilter) do
      assert_equal(
        "data-src='src' data-widths='100, 200'",
        Template.parse("{{ 'img' | html_tag: data-src: 'src', data-widths: '100, 200' }}").render(nil, nil)
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liquid-5.3.0 test/integration/filter_kwarg_test.rb
liquid-5.2.0 test/integration/filter_kwarg_test.rb