Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_ui_reply_01_filetest.gno

2.75 Kb · 84 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_ui_reply_01_filetest
 2
 3// Render comment/reply view of a deleted comment.
 4package z_ui_reply_01_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards/v0"
10
11	boards2 "gno.land/r/gnoland/boards2/v0"
12)
13
14const (
15	owner     address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
16	boardName         = "test-board"
17)
18
19var (
20	threadID boards.ID
21	replyID  boards.ID
22)
23
24func init(cur realm) {
25	testing.SetRealm(testing.NewUserRealm(owner))
26
27	// Create a board and a thread
28	boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
29	threadID = boards2.CreateThread(cross(cur), boardID, "Foo", "Body")
30
31	// Create a comments with a reply
32	replyID = boards2.CreateReply(cross(cur), boardID, threadID, 0, "Second comment")
33	boards2.CreateReply(cross(cur), boardID, threadID, replyID, "Third comment")
34
35	// Delete the comment
36	boards2.DeleteReply(cross(cur), boardID, threadID, replyID)
37}
38
39func main() {
40	path := boardName + "/" + threadID.String() + "/" + replyID.String()
41	println(boards2.Render(path))
42}
43
44// Output:
45// ## Foo
46//
47// **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC
48//
49//
50// <gno-foreign>
51// Body
52// </gno-foreign>
53//
54//
55//
56// ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/flag) • [Repost](/r/gnoland/boards2/v0:test-board/1/repost) • [Comment](/r/gnoland/boards2/v0:test-board/1/reply) [1] • [Edit](/r/gnoland/boards2/v0:test-board/1/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteThread&boardID=1&threadID=1) • [Show all Replies](/r/gnoland/boards2/v0:test-board/1)
57//
58//
59// >
60// > **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC [\#2](/r/gnoland/boards2/v0:test-board/1/2)
61// >
62// >
63// > <gno-foreign>
64// > ⚠ This comment has been deleted
65// > </gno-foreign>
66// >
67// >
68// >
69// > ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/2/flag) • [Reply](/r/gnoland/boards2/v0:test-board/1/2/reply) [1] • [Edit](/r/gnoland/boards2/v0:test-board/1/2/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteReply&boardID=1&replyID=2&threadID=1)
70//
71// ---
72// Sort by: [newest first](/r/gnoland/boards2/v0:test-board/1/2?order=desc)
73// >
74// > >
75// > > **[g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx](/u/g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx)** `owner` · 2009-02-13 11:31pm UTC [\#3](/r/gnoland/boards2/v0:test-board/1/3)
76// > >
77// > >
78// > > <gno-foreign>
79// > > Third comment
80// > > </gno-foreign>
81// > >
82// > >
83// > >
84// > > ↳ [Flag](/r/gnoland/boards2/v0:test-board/1/3/flag) • [Reply](/r/gnoland/boards2/v0:test-board/1/3/reply) • [Edit](/r/gnoland/boards2/v0:test-board/1/3/edit) • [Delete](/r/gnoland/boards2/v0$help&func=DeleteReply&boardID=1&replyID=3&threadID=1)