|
@@ -98,13 +98,17 @@ func TestPostPage(t *testing.T) {
|
|
|
for _, want := range []string{
|
|
for _, want := range []string{
|
|
|
"<title>Middle · posts.example.com</title>",
|
|
"<title>Middle · posts.example.com</title>",
|
|
|
"<p>Middle body</p>",
|
|
"<p>Middle body</p>",
|
|
|
- `<a class="newer" href="/posts/newest">`,
|
|
|
|
|
- `<a class="older" href="/posts/oldest">`,
|
|
|
|
|
|
|
+ `<a class="older" href="/posts/oldest">← Oldest</a>`,
|
|
|
|
|
+ `<a class="newer" href="/posts/newest">Newest →</a>`,
|
|
|
} {
|
|
} {
|
|
|
if !strings.Contains(body, want) {
|
|
if !strings.Contains(body, want) {
|
|
|
t.Errorf("missing %q in:\n%s", want, body)
|
|
t.Errorf("missing %q in:\n%s", want, body)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // Previous (older) on the left, next (newer) on the right.
|
|
|
|
|
+ if strings.Index(body, `class="older"`) > strings.Index(body, `class="newer"`) {
|
|
|
|
|
+ t.Error("older link should come before the newer link")
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
_, _, newest := get(t, srv, "/posts/newest")
|
|
_, _, newest := get(t, srv, "/posts/newest")
|
|
|
if strings.Contains(newest, `class="newer"`) {
|
|
if strings.Contains(newest, `class="newer"`) {
|