Skip to content

Commit

Permalink
Adds a valid xmlns attribute to svg tag
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelpismel authored and thutterer committed Jun 30, 2022
1 parent 4249f74 commit c239774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/initials/svg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def name

def to_s
svg = [
"<svg width='#{size}' height='#{size}'>",
"<svg xmlns='http://www.w3.org/2000/svg' width='#{size}' height='#{size}'>",
shape == :rect ?
"<rect width='#{size}' height='#{size}' rx='#{size / 32}' ry='#{size / 32}' fill='#{fill}' />"
:
Expand Down
6 changes: 6 additions & 0 deletions spec/svg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
end
end

describe "svg tag" do
it "has valid xmlns attribute" do
expect(subject.to_s).to match(/^<svg xmlns='http:\/\/www.w3.org\/2000\/svg'.+<\/svg>/)
end
end

describe "size" do
let(:options) { {size: 512} }

Expand Down

0 comments on commit c239774

Please sign in to comment.