mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-24 10:02:35 +00:00
parent
dd85c29091
commit
ab70e6f52f
1 changed files with 24 additions and 6 deletions
|
@ -40,6 +40,10 @@ const (
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Blog"
|
name = "Blog"
|
||||||
url = "/posts"
|
url = "/posts"
|
||||||
|
[[menu.main]]
|
||||||
|
name = "ext"
|
||||||
|
url = "http://gohugo.io"
|
||||||
|
identifier = "ext"
|
||||||
[[menu.grandparent]]
|
[[menu.grandparent]]
|
||||||
name = "grandparent"
|
name = "grandparent"
|
||||||
url = "/grandparent"
|
url = "/grandparent"
|
||||||
|
@ -306,18 +310,32 @@ func TestPageMenu(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// issue #888
|
func TestMenuURL(t *testing.T) {
|
||||||
func TestMenuWithHashInURL(t *testing.T) {
|
|
||||||
viper.Reset()
|
viper.Reset()
|
||||||
defer viper.Reset()
|
defer viper.Reset()
|
||||||
|
|
||||||
s := setupMenuTests(t, MENU_PAGE_SOURCES)
|
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"},
|
||||||
|
} {
|
||||||
|
|
||||||
assert.NotNil(t, me)
|
if this.me == nil {
|
||||||
|
t.Errorf("[%d] MenuEntry not found", i)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
// issue #719
|
||||||
|
|
Loading…
Reference in a new issue