summaryrefslogtreecommitdiffstats
path: root/hugolib/taxonomy_test.go
diff options
context:
space:
mode:
authorAnton Staaf <github@socialhacker.com>2017-03-05 12:24:14 -0800
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-05 21:24:14 +0100
commitc95069990795965c34059b6844fe9fa5125be7c1 (patch)
tree026805cb68b325d3bf045dc86596aba8f415f2dd /hugolib/taxonomy_test.go
parent6c5ef71368edfae8ffc77224ff6a9ec240c39626 (diff)
hugolib: Populate the taxonomy term Pages list
Previously this was left empty, but it is very handy to have a list of term pages for a given taxonomy. This list can now be paginated like other page lists. It makes it possible to render summary content from each terms index page for instance. It also makes it possible to sort the term pages in the same way that other page lists can be sorted. An RSS feed is now generated for KindTaxonomyTerm pages as well. This also fixes a bug in HugoSites.createMissingPages. Previously it would only check for existing KindTaxonomyTerm pages if the taxonomy had any terms defined. So for a taxonomy with no terms but a taxonomy terms page it would generate a second empty terms page.
Diffstat (limited to 'hugolib/taxonomy_test.go')
-rw-r--r--hugolib/taxonomy_test.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go
index 5687cc032..6843838b9 100644
--- a/hugolib/taxonomy_test.go
+++ b/hugolib/taxonomy_test.go
@@ -15,7 +15,6 @@ package hugolib
import (
"fmt"
- "html/template"
"path/filepath"
"reflect"
"testing"
@@ -127,9 +126,24 @@ others:
s := h.Sites[0]
- // Issue #1302
- term := s.getPage(KindTaxonomyTerm, "others")
- require.Equal(t, template.URL(""), term.RSSLink)
+ // Make sure that each KindTaxonomyTerm page has an appropriate number
+ // of KindTaxonomy pages in its Pages slice.
+ taxonomyTermPageCounts := map[string]int{
+ "tags": 2,
+ "categories": 2,
+ "others": 2,
+ "empties": 0,
+ }
+
+ for taxonomy, count := range taxonomyTermPageCounts {
+ term := s.getPage(KindTaxonomyTerm, taxonomy)
+ require.NotNil(t, term)
+ require.Len(t, term.Pages, count)
+
+ for _, page := range term.Pages {
+ require.Equal(t, KindTaxonomy, page.Kind)
+ }
+ }
// Issue #3070 preserveTaxonomyNames
if preserveTaxonomyNames {