Sha256: 52fa1374feb36ff00386868b3183513a66faceca9aa6944f4893f8f720efef52

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

require 'spec_helper'

RSpec.describe Prawn::SVG::CSS do
  describe "#parse_font_family_string" do
    it "correctly handles quotes and escaping" do
      tests = {
        "" => [],
        "font" => ["font"],
        "font name, other font" => ["font name", "other font"],
        "'font name', other font" => ["font name", "other font"],
        "'font, name', other font" => ["font, name", "other font"],
        '"font name", other font' => ["font name", "other font"],
        '"font, name", other font' => ["font, name", "other font"],
        'weird \\" name' => ['weird " name'],
        'weird\\, name' => ["weird, name"],
        ' stupid , spacing ' => ["stupid", "spacing"],
      }

      tests.each do |string, expected|
        expect(Prawn::SVG::CSS.parse_font_family_string(string)).to eq expected
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
prawn-svg-0.27.1 spec/prawn/svg/css_spec.rb
prawn-svg-0.27.0 spec/prawn/svg/css_spec.rb
prawn-svg-0.26.0 spec/prawn/svg/css_spec.rb
prawn-svg-0.25.2 spec/prawn/svg/css_spec.rb
prawn-svg-0.25.1 spec/prawn/svg/css_spec.rb
prawn-svg-0.25.0 spec/prawn/svg/css_spec.rb
prawn-svg-0.24.0 spec/prawn/svg/css_spec.rb
prawn-svg-0.23.1 spec/prawn/svg/css_spec.rb
prawn-svg-0.23.0 spec/prawn/svg/css_spec.rb