fix(html): use locale setter in render path
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
5784b76990
commit
8402485489
3 changed files with 3 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ func renderToString(_ js.Value, args []js.Value) any {
|
|||
ctx := html.NewContext()
|
||||
|
||||
if len(args) >= 2 && args[1].Type() == js.TypeString {
|
||||
ctx.Locale = args[1].String()
|
||||
ctx.SetLocale(args[1].String())
|
||||
}
|
||||
|
||||
layout := html.NewLayout(variant)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func NewContext(locale ...string) *Context {
|
|||
Data: make(map[string]any),
|
||||
}
|
||||
if len(locale) > 0 {
|
||||
ctx.Locale = locale[0]
|
||||
ctx.SetLocale(locale[0])
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func TestVariantSelector_Escapes_Good(t *testing.T) {
|
|||
|
||||
func TestVariantSelector_ControlChars_Escape_Good(t *testing.T) {
|
||||
got := VariantSelector("a\tb\nc\u0007")
|
||||
want := `[data-variant="a\\9 b\\A \\7 "]`
|
||||
want := `[data-variant="a\9 b\A c\7 "]`
|
||||
if got != want {
|
||||
t.Fatalf("VariantSelector control escapes = %q, want %q", got, want)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue