From 075bc1760da574e4185f55f57457c8d8526f2aa2 Mon Sep 17 00:00:00 2001 From: MaxSorokin Date: Thu, 9 Feb 2023 15:49:31 +0400 Subject: [PATCH] [7.3.3] Check oParagraph.SetFontFamily --- js/docx/smoke/api_paragraph/set_font_family.js | 8 ++++++++ spec/docx/smoke/api_paragraph_spec.rb | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 js/docx/smoke/api_paragraph/set_font_family.js 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 b8a2a633a..46b31077e 100644 --- a/spec/docx/smoke/api_paragraph_spec.rb +++ b/spec/docx/smoke/api_paragraph_spec.rb @@ -259,4 +259,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