Skip to content

Commit

Permalink
Rename to pageOnEmptyData (was pageIfNoData)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaza committed Mar 18, 2021
1 parent de37b14 commit b15c01c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Plugins/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Pagination {

const totalPages =
items.length ? items.length : (
this.data.pagination.pageIfNoData ? 1 : 0);
this.data.pagination.pageOnEmptyData ? 1 : 0);

for (let pageNumber = 0; pageNumber < totalPages; pageNumber++) {
let cloned = tmpl.clone();
Expand Down
4 changes: 2 additions & 2 deletions test/PaginationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ test("Empty paged data", async (t) => {
t.is((await paging.getPageTemplates()).length, 0);
});

test("Empty paged data with pageIfNoData enabled", async (t) => {
test("Empty paged data with pageOnEmptyData enabled", async (t) => {
let eleventyConfig = new TemplateConfig();
let tmpl = getNewTemplate(
"./test/stubs/paged/paged-empty-pageifnodata.njk",
"./test/stubs/paged/paged-empty-pageonemptydata.njk",
"./test/stubs/",
"./dist",
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pagination:
data: items
size: 1
pageIfNoData: true
pageOnEmptyData: true
items: []
---
<ol>{% for item in pagination.items %}<li>{{ item }}</li>{% endfor %}</ol>

0 comments on commit b15c01c

Please sign in to comment.