Skip to content

Commit

Permalink
adding span class
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni committed Jun 16, 2018
1 parent 2cdce36 commit 91599bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ func pageLI(text string, page int, path string, pagination Paginator) (*Tag, err
if page == 0 || page > pagination.TotalPages {
li.Options["class"] = strings.Join([]string{lio["class"].(string), "disabled"}, " ")
li.Append(New("span", Options{
"body": text,
"body": text,
"class": "page-link",
}))
return li, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Test_Pagination_Page1(t *testing.T) {
})
r.NoError(err)

r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item disabled"><span>&laquo;</span></li><li class="page-item active"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">&raquo;</a></li></ul>`), tag.HTML())
r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item disabled"><span class="page-link">&laquo;</span></li><li class="page-item active"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">&raquo;</a></li></ul>`), tag.HTML())
}

func Test_Pagination_Page3(t *testing.T) {
Expand All @@ -46,7 +46,7 @@ func Test_Pagination_Page3(t *testing.T) {
})
r.NoError(err)

r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item"><a class="page-link" href="/foo?page=2">&laquo;</a></li><li class="page-item"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item active"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item disabled"><span>&raquo;</span></li></ul>`), tag.HTML())
r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item"><a class="page-link" href="/foo?page=2">&laquo;</a></li><li class="page-item"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item active"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item disabled"><span class="page-link">&raquo;</span></li></ul>`), tag.HTML())
}

func Test_Pagination_LongPageStart(t *testing.T) {
Expand All @@ -60,7 +60,7 @@ func Test_Pagination_LongPageStart(t *testing.T) {
})
r.NoError(err)

r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item disabled"><span>&laquo;</span></li><li class="page-item active"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item"><a class="page-link" href="/foo?page=4">4</a></li><li class="page-item"><a class="page-link" href="/foo?page=5">5</a></li><li class="page-item"><a class="page-link" href="/foo?page=6">6</a></li><li class="page-item"><a class="page-link" href="/foo?page=7">7</a></li><li class="page-item"><a class="page-link" href="/foo?page=8">8</a></li><li class="page-item"><a class="page-link" href="/foo?page=9">9</a></li><li class="page-item disabled"><a>...</a></li><li class="page-item"><a class="page-link" href="/foo?page=29">29</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">&raquo;</a></li></ul>`), tag.HTML())
r.Equal(template.HTML(`<ul class=" pagination"><li class="page-item disabled"><span class="page-link">&laquo;</span></li><li class="page-item active"><a class="page-link" href="/foo?page=1">1</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">2</a></li><li class="page-item"><a class="page-link" href="/foo?page=3">3</a></li><li class="page-item"><a class="page-link" href="/foo?page=4">4</a></li><li class="page-item"><a class="page-link" href="/foo?page=5">5</a></li><li class="page-item"><a class="page-link" href="/foo?page=6">6</a></li><li class="page-item"><a class="page-link" href="/foo?page=7">7</a></li><li class="page-item"><a class="page-link" href="/foo?page=8">8</a></li><li class="page-item"><a class="page-link" href="/foo?page=9">9</a></li><li class="page-item disabled"><a>...</a></li><li class="page-item"><a class="page-link" href="/foo?page=29">29</a></li><li class="page-item"><a class="page-link" href="/foo?page=2">&raquo;</a></li></ul>`), tag.HTML())
}

func Test_Pagination_LongPageStartPoint1(t *testing.T) {
Expand Down

0 comments on commit 91599bb

Please sign in to comment.