Sha256: e5ca161b778d6aec1d54910bf7ee3d9a852cfcd7edabdbc3c429616da67b73ac

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

require "spec_helper"

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

  it_should_use tag: :ptab, name: "absolute_position_tab"

  with_no_attributes_set do
    it_should_output "<w:ptab/>", assign: false
  end

  for_attribute(:alignment) do
   %i(center left right).each do |allowed_value|
      with_value(allowed_value) do
        it_should_assign_successfully
        it_should_output "<w:ptab w:alignment=\"#{allowed_value}\"/>"
      end
    end

    with_value(:somethingElse) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:leader) do
    %i(dot hyphen middleDot none underscore).each do |allowed_value|
      with_value(allowed_value) do
        it_should_assign_successfully
        it_should_output "<w:ptab w:leader=\"#{allowed_value}\"/>"
      end
    end

    with_value(:somethingElse) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:relative_to) do
    with_value(:indent) do
      it_should_assign_successfully
      it_should_output "<w:ptab w:relativeTo=\"indent\"/>"
    end

    with_value(:margin) do
      it_should_assign_successfully
      it_should_output "<w:ptab w:relativeTo=\"margin\"/>"
    end

    with_value(:somethingElse) do
      it_should_raise_an_exception
    end
  end

  with_these_attributes_set(alignment: :center, relative_to: :margin) do
    it_should_output "<w:ptab w:alignment=\"center\" w:relativeTo=\"margin\"/>", assign: false
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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