File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 610610 expect ( @doc . default_paragraph_style ) . to eq 'Normal'
611611 end
612612
613- it 'reads document styles' do
613+ it 'manipulates existing document styles' do
614614 styles_config = @doc . styles_configuration
615615
616616 expect ( styles_config . size ) . to eq 37
617617
618- expect ( styles_config . style_of ( 'Normal' ) ) . to be_a ( Docx ::Elements ::Style )
618+ heading_style = styles_config . style_of ( 'Normal' )
619+ expect ( heading_style ) . to be_a ( Docx ::Elements ::Style )
620+
621+ expect ( heading_style . id ) . to eq "Normal"
622+ expect ( heading_style . font_color ) . to eq ( nil )
623+
624+ heading_style . font_color = "000000"
625+ expect ( heading_style . font_color ) . to eq ( "000000" )
626+
627+ expect ( heading_style . node . at_xpath ( "w:rPr/w:color/@w:val" ) . value ) . to eq ( "000000" )
619628 end
620629
621- it 'manipulates document styles' do
630+ it 'creates document styles' do
622631 styles_config = @doc . styles_configuration
623632
624633 expect ( styles_config . size ) . to eq 37
Original file line number Diff line number Diff line change 9898 style . id = "blue"
9999 style . name = "Blue"
100100 style . font_size = 20
101+ style . font_color = "0000FF"
101102
102103 expect ( style . to_xml ) . to eq ( node . to_xml )
103104 expect ( style . to_xml ) . to include ( '<w:style w:type="paragraph" w:styleId="blue">' )
104105 expect ( style . to_xml ) . to include ( '<w:name w:val="Blue"/>' )
105106 expect ( style . to_xml ) . to include ( '<w:next w:val="Blue"/>' )
106107 expect ( style . to_xml ) . to include ( '<w:sz w:val="40"/>' )
107108 expect ( style . to_xml ) . to include ( '<w:szCs w:val="40"/>' )
109+ expect ( style . to_xml ) . to include ( '<w:color w:val="0000FF"/>' )
108110 end
109111 end
110112
You can’t perform that action at this time.
0 commit comments