Sha256: 40b6a7b0a9ed4e831353d0d18d2795d1190902f8440beb488a06fc0ac65d47b5
Contents?: true
Size: 1.53 KB
Versions: 15
Compression:
Stored size: 1.53 KB
Contents
require 'inline_svg/transform_pipeline' describe InlineSvg::TransformPipeline::Transformations::Title do it "adds a title element as the first element in the SVG document" do document = Nokogiri::XML::Document.parse('<svg>Some document</svg>') transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title") expect(transformation.transform(document).to_html).to eq( "<svg><title>Some Title</title>Some document</svg>\n" ) end it "overwrites the content of an existing title element" do document = Nokogiri::XML::Document.parse('<svg><title>My Title</title>Some document</svg>') transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title") expect(transformation.transform(document).to_html).to eq( "<svg><title>Some Title</title>Some document</svg>\n" ) end it "handles empty SVG documents" do document = Nokogiri::XML::Document.parse('<svg></svg>') transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title") expect(transformation.transform(document).to_html).to eq( "<svg><title>Some Title</title></svg>\n" ) end it "handles non-ASCII characters" do document = Nokogiri::XML::Document.parse('<svg>Some document</svg>') transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("åäö") expect(transformation.transform(document).to_html).to eq( "<svg><title>åäö</title>Some document</svg>\n" ) end end
Version data entries
15 entries across 15 versions & 2 rubygems