Skip to content

Commit ebf4836

Browse files
committed
Improve A tag
1 parent 743e5d1 commit ebf4836

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/prawn_html/tags/a.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ module Tags
55
class A < Tag
66
ELEMENTS = [:a].freeze
77

8-
def tag_styles
9-
return unless attrs.href
8+
def extra_styles
9+
attrs.href ? "href: #{attrs.href}" : nil
10+
end
1011

12+
def tag_styles
1113
<<~STYLES
1214
color: #00E;
13-
href: #{attrs.href};
1415
text-decoration: underline;
1516
STYLES
1617
end

spec/units/prawn_html/tags/a_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
end
1212

1313
it "styles doesn't include the link property" do
14-
expect(a.styles).to eq(color: 'ffbb11')
14+
expect(a.styles).to eq(color: 'ffbb11', styles: [:underline])
1515
end
1616
end
1717

0 commit comments

Comments
 (0)