Sha256: 8fbf87a9821fd7fecd00dc8ccb72e2aa358e2ed315917ea19101f4b86a267f30

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Elements::Background do
  include ElementTestMacros

  it_should_use tag: :background, name: "background"

  for_attribute(:color) do
    with_value("FF00AA") do
      it_should_assign_successfully
      it_should_output "<w:background w:color=\"FF00AA\"/>"
    end

    with_values([:blue, "1ff0aa"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:theme_color) do
    with_value(:accent1) do
      it_should_assign_successfully
      it_should_output "<w:background w:themeColor=\"accent1\"/>"
    end

    with_value(:not_allowed) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:theme_shade) do
    with_value("0F") do
      it_should_assign_successfully
      it_should_output "<w:background w:themeShade=\"0F\"/>"
    end

    with_values([:red, "00FF", "0f"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:theme_tint) do
    with_value("0F") do
      it_should_assign_successfully
      it_should_output "<w:background w:themeTint=\"0F\"/>"
    end

    with_values([:red, "00FF", "0f"]) do
      it_should_raise_an_exception
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/elements/background_spec.rb
openxml-docx-0.10.5 spec/elements/background_spec.rb
openxml-docx-0.10.4 spec/elements/background_spec.rb
openxml-docx-0.10.3 spec/elements/background_spec.rb
openxml-docx-0.10.2 spec/elements/background_spec.rb