Sha256: dd866355f1dae347bda0c868cf68f8ebfd015513de9e9e2ff0e70e8497bc5393

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 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

4 entries across 4 versions & 4 rubygems

Version Path
shoes-core-4.0.0.pre3 spec/shoes/common/style_normalizer_spec.rb
shoes-swt-4.0.0.pre2 spec/shoes/common/style_normalizer_spec.rb
shoes-dsl-4.0.0.pre2 spec/shoes/common/style_normalizer_spec.rb
shoes-4.0.0.pre1 spec/shoes/common/style_normalizer_spec.rb