Merge pull request #4557 from timwis/patch-2

Merge pull request 4557
This commit is contained in:
jekyllbot 2016-02-29 16:08:11 -08:00
commit cddea273a9
2 changed files with 9 additions and 1 deletions

View File

@ -205,7 +205,7 @@ module Jekyll
input.group_by do |item| input.group_by do |item|
item_property(item, property).to_s item_property(item, property).to_s
end.inject([]) do |memo, i| end.inject([]) do |memo, i|
memo << { "name" => i.first, "items" => i.last } memo << { "name" => i.first, "items" => i.last, "size" => i.last.size }
end end
else else
input input

View File

@ -289,6 +289,14 @@ class TestFilters < JekyllUnitTest
end end
end end
end end
should "include the size of each grouping" do
@filter.site.process
grouping = @filter.group_by(@filter.site.pages, "layout")
grouping.each do |g|
assert_equal g["items"].size, g["size"], "The size property for '#{g["name"]}' doesn't match the size of the Array."
end
end
end end
context "where filter" do context "where filter" do