diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-08-09 20:06:15 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-09-06 18:32:19 +0300 |
commit | a07293cf9741c9b5c10c80db9870ebfd2d2849c1 (patch) | |
tree | 4101356ed2a8e55a1818497e901998aee8f8178e /hugolib/pagination_test.go | |
parent | d1212307f257a36c2894d370d7448a1296da4ab3 (diff) |
Create a Node map to get proper node translations
In a multi-language setup, before this commit the Node's Translations() method
would return some "dummy nodes" that would point to the correct page (Permalink),
but would not be the same as the node it points to -- it would not have the translated
title etc.
The node creation is, however, so mingled with rendering, whihc is too early to have any global state,
so the nodes has to be split in a prepare and a render phase. This commits does that with as small
a change as possible. This implementation is a temp solution until we fix #2297.
Updates #2309
Diffstat (limited to 'hugolib/pagination_test.go')
-rw-r--r-- | hugolib/pagination_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/hugolib/pagination_test.go b/hugolib/pagination_test.go index df2094d63..6f85e91d3 100644 --- a/hugolib/pagination_test.go +++ b/hugolib/pagination_test.go @@ -224,8 +224,8 @@ func doTestPaginator(t *testing.T, useViper bool) { } pages := createTestPages(12) s := newSiteDefaultLang() - n1 := s.newHomeNode() - n2 := s.newHomeNode() + n1 := s.newHomeNode(true, 0) + n2 := s.newHomeNode(true, 1) n1.Data["Pages"] = pages var paginator1 *Pager @@ -261,7 +261,7 @@ func TestPaginatorWithNegativePaginate(t *testing.T) { viper.Set("paginate", -1) s := newSiteDefaultLang() - _, err := s.newHomeNode().Paginator() + _, err := s.newHomeNode(true, 0).Paginator() assert.NotNil(t, err) } @@ -283,8 +283,8 @@ func doTestPaginate(t *testing.T, useViper bool) { pages := createTestPages(6) s := newSiteDefaultLang() - n1 := s.newHomeNode() - n2 := s.newHomeNode() + n1 := s.newHomeNode(true, 0) + n2 := s.newHomeNode(true, 1) var paginator1, paginator2 *Pager var err error @@ -316,7 +316,7 @@ func doTestPaginate(t *testing.T, useViper bool) { func TestInvalidOptions(t *testing.T) { s := newSiteDefaultLang() - n1 := s.newHomeNode() + n1 := s.newHomeNode(true, 0) _, err := n1.Paginate(createTestPages(1), 1, 2) assert.NotNil(t, err) _, err = n1.Paginator(1, 2) @@ -330,7 +330,7 @@ func TestPaginateWithNegativePaginate(t *testing.T) { viper.Set("paginate", -1) s := newSiteDefaultLang() - _, err := s.newHomeNode().Paginate(createTestPages(2)) + _, err := s.newHomeNode(true, 0).Paginate(createTestPages(2)) assert.NotNil(t, err) } @@ -352,8 +352,8 @@ func TestPaginatorFollowedByPaginateShouldFail(t *testing.T) { viper.Set("paginate", 10) s := newSiteDefaultLang() - n1 := s.newHomeNode() - n2 := s.newHomeNode() + n1 := s.newHomeNode(true, 0) + n2 := s.newHomeNode(true, 1) _, err := n1.Paginator() assert.Nil(t, err) @@ -370,8 +370,8 @@ func TestPaginateFollowedByDifferentPaginateShouldFail(t *testing.T) { viper.Set("paginate", 10) s := newSiteDefaultLang() - n1 := s.newHomeNode() - n2 := s.newHomeNode() + n1 := s.newHomeNode(true, 0) + n2 := s.newHomeNode(true, 1) p1 := createTestPages(2) p2 := createTestPages(10) |