summaryrefslogtreecommitdiffstats
path: root/hugolib/menu_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-01-14 15:14:21 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-01-14 15:14:21 +0100
commitab70e6f52f644aae8abfbdf21561ad597c0038a7 (patch)
tree62032f2588761c385eb15aa270c3f72ff58467fb /hugolib/menu_test.go
parentdd85c290911e57eafd9f41e66005b54225e72eb0 (diff)
Add menu test for external URL
See #1774
Diffstat (limited to 'hugolib/menu_test.go')
-rw-r--r--hugolib/menu_test.go30
1 files changed, 24 insertions, 6 deletions
diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go
index c7701e5a7..49a5b5c6d 100644
--- a/hugolib/menu_test.go
+++ b/hugolib/menu_test.go
@@ -40,6 +40,10 @@ const (
[[menu.main]]
name = "Blog"
url = "/posts"
+[[menu.main]]
+ name = "ext"
+ url = "http://gohugo.io"
+ identifier = "ext"
[[menu.grandparent]]
name = "grandparent"
url = "/grandparent"
@@ -306,18 +310,32 @@ func TestPageMenu(t *testing.T) {
}
-// issue #888
-func TestMenuWithHashInURL(t *testing.T) {
+func TestMenuURL(t *testing.T) {
viper.Reset()
defer viper.Reset()
-
s := setupMenuTests(t, MENU_PAGE_SOURCES)
- me := findTestMenuEntryByID(s, "hash", "hash")
+ for i, this := range []struct {
+ me *MenuEntry
+ expectedURL string
+ }{
+ // issue #888
+ {findTestMenuEntryByID(s, "hash", "hash"), "/Zoo/resource#anchor"},
+ // issue #1774
+ {findTestMenuEntryByID(s, "main", "ext"), "http://gohugo.io"},
+ } {
+
+ if this.me == nil {
+ t.Errorf("[%d] MenuEntry not found", i)
+ continue
+ }
- assert.NotNil(t, me)
+ if this.me.URL != this.expectedURL {
+ t.Errorf("[%d] Got URL %s expected %s", i, this.me.URL, this.expectedURL)
+ }
+
+ }
- assert.Equal(t, "/Zoo/resource#anchor", me.URL)
}
// issue #719