Sha256: 54a2754548b34ca3d96602db7b74441bbf9f7eaa3ef6199ad70339478f4bf101

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Section do
  include ElementTestMacros

  it_should_have_property :columns
  it_should_have_property :document_grid
  it_should_have_property :footer_reference
  it_should_have_property :header_reference
  it_should_have_property :line_numbering
  it_should_have_property :page_margins
  it_should_have_property :page_borders
  it_should_have_property :page_numbering
  it_should_have_property :page_size
  it_should_have_property :paper_source

  it_should_have_value_property :bidi, with_value: true
  it_should_have_value_property :form_protection, with_value: true
  it_should_have_value_property :rtl_gutter
  it_should_have_value_property :text_direction, with_value: :lr
  it_should_have_value_property :type, as_instance_of: :section_type, with_value: :oddPage
  it_should_have_value_property :vertical_alignment, as_instance_of: :vertical_text_alignment, with_value: :both
  it_should_have_value_property :title_page, with_value: true
  it_should_have_value_property :even_and_odd_headers, with_value: true

  context "if no attribute are set" do
    before(:each) do
      @instance = described_class.new
    end

    it "should output nothing" do
      expect(xml(instance)).to eq("")
    end
  end

  context "if there are properties set" do
    before(:each) do
      @instance = described_class.new
      instance.bidi = true
      instance.columns << OpenXml::Docx::Properties::Column.new(1, 1)
    end

    it "should output the correct XML" do
      expect(xml(instance)).to eq("<w:sectPr>\n    <w:cols>\n      <w:col w:space=\"1\" w:w=\"1\"/>\n    </w:cols>\n    <w:bidi/>\n  </w:sectPr>")
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/section_spec.rb