Sha256: ddc8b300a738b480c3e53ae8c1722869ef3e7253399446ef3c881ae4b9902f85

Contents?: true

Size: 868 Bytes

Versions: 40

Compression:

Stored size: 868 Bytes

Contents

require 'inline_svg/transform_pipeline'

describe InlineSvg::TransformPipeline::Transformations::Size do
  it "adds width and height attributes to a SVG document" do
    document = Nokogiri::XML::Document.parse('<svg>Some document</svg>')
    transformation = InlineSvg::TransformPipeline::Transformations::Size.create_with_value("5% * 5%")

    expect(transformation.transform(document).to_html).to eq(
      "<svg width=\"5%\" height=\"5%\">Some document</svg>\n"
    )
  end

  it "adds the same width and height value when only passed one attribute" do
    document = Nokogiri::XML::Document.parse('<svg>Some document</svg>')
    transformation = InlineSvg::TransformPipeline::Transformations::Size.create_with_value("5%")

    expect(transformation.transform(document).to_html).to eq(
      "<svg width=\"5%\" height=\"5%\">Some document</svg>\n"
    )
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
inline_svg-1.10.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.9.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.8.0 spec/transformation_pipeline/transformations/size_spec.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/inline_svg-1.7.2/spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.7.2 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.7.1 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.7.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.6.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.5.2 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.5.1 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.5.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.4.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.3.1 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.3.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.2.3 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.2.2 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.2.1 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.2.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.1.0 spec/transformation_pipeline/transformations/size_spec.rb
inline_svg-1.0.1 spec/transformation_pipeline/transformations/size_spec.rb