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_edit_reply_08_filetest.gno

1.12 Kb · 39 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_edit_reply_08_filetest
 2
 3// Editing a reply to contain a <gno-form> is now accepted: the
 4// write-time blacklist relaxation applies to edits too (EditReply shares
 5// the validator). The body renders inside a <gno-foreign> sandbox.
 6package z_edit_reply_08_filetest
 7
 8import (
 9	"strings"
10	"testing"
11
12	"gno.land/p/gnoland/boards/v0"
13
14	boards2 "gno.land/r/gnoland/boards2/v0"
15)
16
17const owner address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
18
19var bid, tid, rid boards.ID
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
24	tid = boards2.CreateThread(cross(cur), bid, "Foo", "bar")
25	rid = boards2.CreateReply(cross(cur), bid, tid, 0, "body")
26}
27
28func main(cur realm) {
29	testing.SetRealm(testing.NewUserRealm(owner))
30
31	// Previously rejected on edit ("forms are not allowed in replies").
32	boards2.EditReply(cross(cur), bid, tid, rid, "<gno-form><gno-select name=\"foo\" value=\"\" /></gno-form>")
33
34	content := boards2.Render("test-board/1")
35	println(strings.Contains(content, "<gno-foreign>"))
36}
37
38// Output:
39// true