|
225 | 225 | expect(@doc.paragraphs[5].text_runs[0].italicized?).to eq(false) |
226 | 226 | expect(@doc.paragraphs[5].text_runs[0].bolded?).to eq(false) |
227 | 227 | expect(@doc.paragraphs[5].text_runs[0].underlined?).to eq(false) |
228 | | - |
| 228 | + |
229 | 229 | expect(@formatting[5][1]).to eq(@all_formatted) |
230 | 230 | expect(@doc.paragraphs[5].text_runs[1].italicized?).to eq(true) |
231 | 231 | expect(@doc.paragraphs[5].text_runs[1].bolded?).to eq(true) |
232 | 232 | expect(@doc.paragraphs[5].text_runs[1].underlined?).to eq(true) |
233 | | - |
| 233 | + |
234 | 234 | expect(@formatting[5][2]).to eq(@default_formatting) |
235 | 235 | expect(@doc.paragraphs[5].text_runs[2].italicized?).to eq(false) |
236 | 236 | expect(@doc.paragraphs[5].text_runs[2].bolded?).to eq(false) |
|
309 | 309 | File.delete(@new_doc_path) |
310 | 310 | end |
311 | 311 | end |
| 312 | + |
| 313 | + context 'wps modified docx file' do |
| 314 | + before { @doc = Docx::Document.open(@fixtures_path + '/saving_wps.docx') } |
| 315 | + it 'should save to a normal file path' do |
| 316 | + @new_doc_path = @fixtures_path + '/new_save.docx' |
| 317 | + @doc.save(@new_doc_path) |
| 318 | + @new_doc = Docx::Document.open(@new_doc_path) |
| 319 | + expect(@new_doc.paragraphs.size).to eq(@doc.paragraphs.size) |
| 320 | + end |
| 321 | + end |
312 | 322 | end |
313 | 323 |
|
314 | 324 | describe 'outputting html' do |
|
327 | 337 | expect(scan.last).to eq('</p>') |
328 | 338 | expect(scan[1]).to eq('Normal') |
329 | 339 | end |
330 | | - |
| 340 | + |
331 | 341 | it 'should emphasize italicized text' do |
332 | 342 | scan = @doc.paragraphs[1].to_html.scan(@em_regex).flatten |
333 | 343 | expect(scan.first).to eq('<em') |
|
355 | 365 | end |
356 | 366 |
|
357 | 367 | it "should set font size on styled paragraphs" do |
358 | | - regex = /(\<p{1})[^\>]+style\=\"([^\"]+).+(<\/p>)/ |
| 368 | + regex = /(\<p{1})[^\>]+style\=\"([^\"]+).+(<\/p>)/ |
359 | 369 | scan = @doc.paragraphs[9].to_html.scan(regex).flatten |
360 | 370 | expect(scan.first).to eq '<p' |
361 | 371 | expect(scan.last).to eq '</p>' |
|
0 commit comments