Skip to content

Commit

Permalink
69253 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonowl committed Oct 1, 2024
1 parent dc716d1 commit 33c73c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/docx/negative/api_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe 'ApiRange section negative tests' do
describe 'ApiRange | GetRange method' do
let(:style) { OoxmlParser::FontStyle.new }
let(:file_path) { 'js/docx/negative/api_range/get_range.js' }
let(:file_path) { 'js/docx/smoke/api_range/get_range_with_params.js' }

it 'Check method with wrong parameters 0, -1' do
docx = builder.build_and_parse(file_path, start_pos: 0, end_pos: -1)
Expand Down
24 changes: 24 additions & 0 deletions spec/docx/smoke/api_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,29 @@
expect(docx.elements[1].nonempty_runs[1].font_style).to eq(style)
expect(docx.elements[1].nonempty_runs[1].font_color.to_s).to eq('RGB (255, 0, 0)')
end

it 'Check method with parameters 0, 15' do
docx = builder.build_and_parse('js/docx/smoke/api_range/get_range_with_params.js', start_pos: 0, end_pos: 17)
expect(docx.elements.size).to eq(1)
expect(docx.elements[0].nonempty_runs.size).to eq(2)

expect(docx.elements[0].nonempty_runs[0].text).to eq('Document Builder')
expect(docx.elements[0].nonempty_runs[0].font_style).to eq(OoxmlParser::FontStyle.new(true))
expect(docx.elements[0].nonempty_runs[1].text).to eq(' check GetRange method')
expect(docx.elements[0].nonempty_runs[1].font_style).to eq(OoxmlParser::FontStyle.new)
end

it 'Check method with parameters 6, 10' do
docx = builder.build_and_parse('js/docx/smoke/api_range/get_range_with_params.js', start_pos: 10, end_pos: 24)
expect(docx.elements.size).to eq(1)
expect(docx.elements[0].nonempty_runs.size).to eq(3)

expect(docx.elements[0].nonempty_runs[0].text).to eq('Document ')
expect(docx.elements[0].nonempty_runs[0].font_style).to eq(OoxmlParser::FontStyle.new)
expect(docx.elements[0].nonempty_runs[1].text).to eq('Builder check ')
expect(docx.elements[0].nonempty_runs[1].font_style).to eq(OoxmlParser::FontStyle.new(true))
expect(docx.elements[0].nonempty_runs[2].text).to eq('GetRange method')
expect(docx.elements[0].nonempty_runs[2].font_style).to eq(OoxmlParser::FontStyle.new)
end
end
end

0 comments on commit 33c73c3

Please sign in to comment.