Skip to content

Commit 4e459b0

Browse files
author
miko53
committed
add test for style API
1 parent a930ea2 commit 4e459b0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

spec/docx/document_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,4 +504,22 @@
504504
expect(doc.to_s).to be_a(String)
505505
end
506506
end
507+
508+
describe 'reading style' do
509+
before do
510+
@doc = Docx::Document.open(@fixtures_path + '/test_with_style.docx')
511+
end
512+
513+
it 'read default style when not' do
514+
nb = @doc.paragraphs.size
515+
expect(nb).to eq 6
516+
expect(@doc.paragraphs[0].style).to eq 'Normal'
517+
expect(@doc.paragraphs[1].style).to eq 'STYLE1'
518+
expect(@doc.paragraphs[2].style).to eq 'heading 1'
519+
expect(@doc.paragraphs[3].style).to eq 'Normal'
520+
expect(@doc.paragraphs[4].style).to eq 'Normal'
521+
expect(@doc.paragraphs[5].style).to eq 'STYLE1'
522+
end
523+
end
524+
507525
end

spec/fixtures/test_with_style.docx

20.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)