Sha256: bb182fe0d1307fd39083094e668f6405646400134644720ae4202964cfd45884

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

require "spec_helper"

describe OpenXml::DrawingML::Elements::FillRectangle do
  include ElementTestMacros

  it_should_use tag: :fillRect, name: "fill_rectangle"

  for_attribute(:bottom_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect b=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect b=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:left_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect l=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect l=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:right_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect r=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect r=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:top_offset) do
    with_value("10%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect t=\"10%\"/>"
    end

    with_value("10.1%") do
      it_should_assign_successfully
      it_should_output "<a:fillRect t=\"10.1%\"/>"
    end

    with_values(["10", 10, "%"]) do
      it_should_raise_an_exception
    end
  end

  with_no_attributes_set do
    it_should_output "<a:fillRect/>", assign: false
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/elements/drawingml/fill_rectangle_spec.rb
openxml-docx-0.10.5 spec/elements/drawingml/fill_rectangle_spec.rb
openxml-docx-0.10.4 spec/elements/drawingml/fill_rectangle_spec.rb
openxml-docx-0.10.3 spec/elements/drawingml/fill_rectangle_spec.rb
openxml-docx-0.10.2 spec/elements/drawingml/fill_rectangle_spec.rb
openxml-docx-0.10.1 spec/elements/drawingml/fill_rectangle_spec.rb