diff --git a/js/docx/smoke/api_paragraph/set_font_family.js b/js/docx/smoke/api_paragraph/set_font_family.js new file mode 100644 index 000000000..3725bf3a4 --- /dev/null +++ b/js/docx/smoke/api_paragraph/set_font_family.js @@ -0,0 +1,8 @@ +builder.CreateFile("docx"); + var oDocument = Api.GetDocument(); + var oParagraph = oDocument.GetElement(0); + oParagraph.AddText("This is a paragraph with the font family set to "); + oParagraph.AddText('Consolas') + oParagraph.SetFontFamily("Consolas"); +builder.SaveFile("docx", "SetFontFamily.docx"); +builder.CloseFile(); diff --git a/spec/docx/smoke/api_paragraph_spec.rb b/spec/docx/smoke/api_paragraph_spec.rb index b526111d3..38631c98a 100644 --- a/spec/docx/smoke/api_paragraph_spec.rb +++ b/spec/docx/smoke/api_paragraph_spec.rb @@ -261,4 +261,9 @@ docx = builder.build_and_parse('js/docx/smoke/api_paragraph/set_widow_control.js') expect(docx.elements[5].orphan_control).to be_truthy end + + it 'ApiParagraph | SetFontFamily method' do + docx = builder.build_and_parse('js/docx/smoke/api_paragraph/set_font_family.js') + expect(docx.elements[0].nonempty_runs[0].font).to eq(docx.elements[0].nonempty_runs[1].text) + end end