|
@@ -1,16 +1,18 @@
|
|
package pgenr
|
|
package pgenr
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "encoding/base64"
|
|
"fmt"
|
|
"fmt"
|
|
"git.nspix.com/golang/pgenr/element"
|
|
"git.nspix.com/golang/pgenr/element"
|
|
"golang.org/x/net/html/atom"
|
|
"golang.org/x/net/html/atom"
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
|
+ "strconv"
|
|
"testing"
|
|
"testing"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
func TestAtom(t *testing.T) {
|
|
func TestAtom(t *testing.T) {
|
|
- fmt.Println(atom.Lookup([]byte("zzz")).String())
|
|
|
|
|
|
+ fmt.Println(strconv.Quote(`{"a":"b"}`))
|
|
}
|
|
}
|
|
|
|
|
|
func TestRender(t *testing.T) {
|
|
func TestRender(t *testing.T) {
|
|
@@ -31,7 +33,17 @@ func TestRender(t *testing.T) {
|
|
table.FixedColumn = true
|
|
table.FixedColumn = true
|
|
table.SetHead(element.NewText("Name"), element.NewText("Age"), element.NewText("Price"), element.NewText("School"), element.NewText("Job"))
|
|
table.SetHead(element.NewText("Name"), element.NewText("Age"), element.NewText("Price"), element.NewText("School"), element.NewText("Job"))
|
|
table.AddCell(element.NewText("ZhanSan"), element.NewText("31"), element.NewText("185.6"), element.NewText("185.6"), element.NewText("185.6"))
|
|
table.AddCell(element.NewText("ZhanSan"), element.NewText("31"), element.NewText("185.6"), element.NewText("185.6"), element.NewText("185.6"))
|
|
- table.AddCell(element.NewText("Lisi"), element.NewText("35"), element.NewText("102.6"), element.NewText("102.6"), element.NewText("102.6"))
|
|
|
|
|
|
+ table.AddCell(element.NewText("Lisi"), element.NewText("35"), element.NewText("102.6"), element.NewText("102.6"),
|
|
|
|
+ element.NewElement(atom.A, "link",
|
|
|
|
+ element.WithAttribute("class", "ajax-request"),
|
|
|
|
+ element.WithAttribute("data-method", "get"),
|
|
|
|
+ element.WithAttribute("data-url", "https://vrgo.nspix.com/healthy"),
|
|
|
|
+ element.WithAttribute("data-success", "hello hello"),
|
|
|
|
+ element.WithAttribute("data-reload", "hello hello"),
|
|
|
|
+ element.WithAttribute("class", "ajax-request"),
|
|
|
|
+ element.WithAttribute("data-data", base64.StdEncoding.EncodeToString([]byte(`{"a":"aaa","b":"as","c":222}`))),
|
|
|
|
+ ),
|
|
|
|
+ )
|
|
page.AddTable(table)
|
|
page.AddTable(table)
|
|
//page.AddButtonAction("To get started with Hermes, please click here:", NewButton("Confirm your account", "https://example-hermes.com/"))
|
|
//page.AddButtonAction("To get started with Hermes, please click here:", NewButton("Confirm your account", "https://example-hermes.com/"))
|
|
//page.AddInviteCodeAction("To get started with Hermes, please click here:", "950038")
|
|
//page.AddInviteCodeAction("To get started with Hermes, please click here:", "950038")
|