Files
marqdo/plugins/web/internal/style/style_test.go
T
cflmyandCursor 7a0309284a feat(web): Go plugin W-G1 assemble/render + SQLite smoke path
Port table/compose/style/render/db/form/app bags, register ABI symbols,
prefer MARQDO_WEB_PLUGIN over ~/.marqdo, and pass web-smoke + web-zh-smoke.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 15:27:12 +08:00

37 lines
783 B
Go

package style_test
import (
"strings"
"testing"
"github.com/marqdo/marqdo/plugins/web/internal/style"
)
func TestStyleSimple(t *testing.T) {
css, err := style.Style(map[string]any{
"name": "card",
"table": []any{
map[string]any{"选择器": ".card", "属性": "color", "值": "navy"},
},
})
if err != nil {
t.Fatal(err)
}
if !strings.Contains(css, ".card {") || !strings.Contains(css, "color: navy;") {
t.Fatalf("%q", css)
}
}
func TestStyleStrictRejectsNumeric(t *testing.T) {
_, err := style.Style(map[string]any{
"name": "x",
"strict": true,
"table": []any{
map[string]any{"选择器": ".x", "属性": "grid-column", "值": float64(0)},
},
})
if err == nil || !strings.Contains(err.Error(), "suspicious") {
t.Fatalf("err=%v", err)
}
}