Sha256: 1606f0b34f4b68cd12aa7c2721615dbb937593181c577f9518b437b88f52f2c4

Contents?: true

Size: 1.58 KB

Versions: 8

Compression:

Stored size: 1.58 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Properties::Shading do
  include PropertyTestMacros

  it_should_use tag: :shd, name: "shading"

  for_attribute(:color) do
    values = ["4F818D", :auto]
    it_should_assign_and_output_xml values
    it_should_not_allow_invalid_value
  end

  for_attribute(:fill) do
    values = ["4F818D", :auto]
    it_should_assign_and_output_xml values
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_color) do
    it_should_assign_and_output_xml :hyperlink
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_fill) do
    it_should_assign_and_output_xml :hyperlink
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_fill_shade) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_fill_tint) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_shade) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_tint) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:pattern) do
    values = %i(pct90 solid vertStripe)
    it_should_assign_and_output_xml values
    it_should_not_allow_invalid_value
  end

  with_no_attributes_set do
    it_should_output "", assign: false
  end

  with_these_attributes_set(pattern: :pct20, theme_color: :accent6, theme_fill: :accent3) do
    it_should_output "<w:shd w:themeColor=\"accent6\" w:themeFill=\"accent3\" w:val=\"pct20\"/>", assign: false
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/properties/shading_spec.rb
openxml-docx-0.10.5 spec/properties/shading_spec.rb
openxml-docx-0.10.4 spec/properties/shading_spec.rb
openxml-docx-0.10.3 spec/properties/shading_spec.rb
openxml-docx-0.10.2 spec/properties/shading_spec.rb
openxml-docx-0.10.1 spec/properties/shading_spec.rb
openxml-docx-0.10.0 spec/properties/shading_spec.rb
openxml-docx-0.9.0 spec/properties/shading_spec.rb