Skip to content

Commit

Permalink
Merge branch 'master' into profile-memory-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Feb 14, 2020
2 parents 394f088 + 17bc2d6 commit d84f315
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
14 changes: 7 additions & 7 deletions lib/jekyll-avatar.rb
Expand Up @@ -26,20 +26,20 @@ def render(context)

def attributes
result = {
:class => classes,
:alt => username,
:width => size,
:height => size,
"class" => classes,
"alt" => username,
"width" => size,
"height" => size,
"data-proofer-ignore" => true
}

if lazy_load?
result[:src] = ""
result["src"] = ""
result["data-src"] = url
result["data-srcset"] = srcset
else
result[:src] = url
result[:srcset] = srcset
result["src"] = url
result["srcset"] = srcset
end

result
Expand Down
38 changes: 19 additions & 19 deletions spec/jekyll/avatar_spec.rb
Expand Up @@ -45,13 +45,13 @@
it "outputs the HTML" do
expect(output).to have_tag("p") do
with_tag "img", :with => {
:alt => username,
:class => "avatar avatar-small",
"alt" => username,
"class" => "avatar avatar-small",
"data-proofer-ignore" => "true",
:height => height,
:src => src,
:srcset => srcset,
:width => width
"height" => height,
"src" => src,
"srcset" => srcset,
"width" => width
}
end
end
Expand Down Expand Up @@ -110,12 +110,12 @@
attrs = subject.send(:attributes)
expect(attrs).to eql({
"data-proofer-ignore" => true,
:class => "avatar avatar-small",
:alt => username,
:src => src,
:srcset => srcset,
:width => width,
:height => height
"class" => "avatar avatar-small",
"alt" => username,
"src" => src,
"srcset" => srcset,
"width" => width,
"height" => height
})
end

Expand Down Expand Up @@ -193,7 +193,7 @@
let(:content) { "{% assign user='#{username}' %}{% avatar {{ user }} %}" }

it "parses the variable" do
expect(output).to have_tag "img", :with => { :src => src }
expect(output).to have_tag "img", :with => { "src" => src }
end
end

Expand All @@ -203,7 +203,7 @@
let(:content) { "{% assign user='hubot2' %}{% avatar user=user %}" }

it "parses the variable" do
expect(output).to have_tag "img", :with => { :src => src }
expect(output).to have_tag "img", :with => { "src" => src }
end
end

Expand All @@ -213,7 +213,7 @@
let(:content) { "{% avatar user=page.author %}" }

it "parses the variable" do
expect(output).to have_tag "img", :with => { :src => src }
expect(output).to have_tag "img", :with => { "src" => src }
end
end

Expand All @@ -229,8 +229,8 @@

it "renders each avatar" do
expect(output).to have_tag("p") do
with_tag "img", :with => { :alt => "a" }
with_tag "img", :with => { :alt => "b" }
with_tag "img", :with => { "alt" => "a" }
with_tag "img", :with => { "alt" => "b" }
end
end
end
Expand All @@ -240,11 +240,11 @@

it "sets the image URL as the data-src" do
expect(output).to have_tag "img", :with => {
:src => "",
"src" => "",
"data-src" => src,
"data-srcset" => srcset
}, :without => {
:srcset => %r!.*!
"srcset" => %r!.*!
}
end
end
Expand Down

0 comments on commit d84f315

Please sign in to comment.