# frozen_string_literal: true require "test_helper" class StyleTest < Minitest::Test include EzdocTestHelpers def test_define_custom_style xml_files = create_doc_and_read_all_xml do |doc| doc.define_style :warning, bold: true, color: "FF0000" doc.p "Test", style: :warning end styles_xml = xml_files["word/styles.xml"] assert_includes styles_xml, 'w:styleId="Warning"' assert_includes styles_xml, "" assert_includes styles_xml, 'w:val="FF0000"' end def test_apply_style_to_paragraph xml = create_doc_and_read_xml do |doc| doc.p "Quote text", style: :quote end assert_includes xml, '" assert_includes styles_xml, "" assert_includes styles_xml, 'w:val="0000FF"' assert_includes styles_xml, 'w:val="32"' # 16pt = 32 half-points assert_includes styles_xml, 'w:ascii="Arial"' assert_includes styles_xml, '