Sha256: 5c68fb918c7e0c9c792daff9062a7128a3f4debadc42b1e60c2054989a137466

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

require 'spec_helper'

describe Shoes::Common::StyleNormalizer do
  subject {Shoes::Common::StyleNormalizer.new}

  it 'does not modify a simple hash' do
    input = {left: 100, width: 233}
    expect(subject.normalize input).to eq input
  end

  it 'turns hexcodes for fill into colors' do
    input = {fill: 'ffffff'}
    expected = {fill: Shoes::Color.new(255, 255, 255)}
    expect(subject.normalize input).to eq expected
  end

  it 'turns hexcodes for stroke into colors' do
    input = {stroke: 'ffffff'}
    expected = {stroke: Shoes::Color.new(255, 255, 255)}
    expect(subject.normalize input).to eq expected
  end

  it 'does not modify the original hash' do
    input = {stroke: '333333'}
    subject.normalize input
    expect(input).to eq(stroke: '333333')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre6 spec/shoes/common/style_normalizer_spec.rb
shoes-core-4.0.0.pre5 spec/shoes/common/style_normalizer_spec.rb
shoes-core-4.0.0.pre4 spec/shoes/common/style_normalizer_spec.rb