z_ui_reply_03_filetest.gno
1.23 Kb · 44 lines
1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_ui_reply_03_filetest
2
3// Render the "reply to a comment" form: the parent-comment preview is now
4// shown inside a labeled <gno-foreign> sandbox (was md.Blockquote, which
5// gave no sandboxing).
6package z_ui_reply_03_filetest
7
8import (
9 "strings"
10 "testing"
11
12 "gno.land/p/gnoland/boards"
13
14 boards2 "gno.land/r/gnoland/boards2/v1"
15)
16
17const (
18 owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
19 boardName = "test-board"
20)
21
22var (
23 threadID boards.ID
24 replyID boards.ID
25)
26
27func init(cur realm) {
28 testing.SetRealm(testing.NewUserRealm(owner))
29 boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
30 threadID = boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
31 replyID = boards2.CreateReply(cross(cur), boardID, threadID, 0, "Parent comment body")
32}
33
34func main() {
35 // The ".../{reply}/reply" route renders the parent-preview branch.
36 path := boardName + "/" + threadID.String() + "/" + replyID.String() + "/reply"
37 content := boards2.Render(path)
38 println(strings.Contains(content, "Replying to a comment posted by") &&
39 strings.Contains(content, `<gno-foreign label="Quoted comment">`) &&
40 strings.Contains(content, "Parent comment body"))
41}
42
43// Output:
44// true