Sha256: 445f2f83c6fd6247e1a1d2e25e57e9ddc336d35236c060215c73336ee855b043
Contents?: true
Size: 1.19 KB
Versions: 16
Compression:
Stored size: 1.19 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 end
Version data entries
16 entries across 16 versions & 1 rubygems