diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-12-30 22:08:22 +0100 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-12-30 22:08:22 +0100 |
| commit | 7bb24a89e53bee4b14522c0e590995d87f6c09ad (patch) | |
| tree | 9b4ed1c965228227f5c1be8dcb4f6eec1df72f8a /ki18n/ki18n_test.go | |
| parent | 968c823f2949ef0e2e5e35b5dac7b6715bc6aaed (diff) | |
Add testing for html tags
Diffstat (limited to 'ki18n/ki18n_test.go')
| -rw-r--r-- | ki18n/ki18n_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ki18n/ki18n_test.go b/ki18n/ki18n_test.go index b9ad997..deb8f30 100644 --- a/ki18n/ki18n_test.go +++ b/ki18n/ki18n_test.go @@ -30,6 +30,15 @@ func TestVariables(t *testing.T) { assert.Equal(t, "Bonjour John", result) } +func TestSpanClass(t *testing.T) { + initFrenchLocale(map[string]string{ + "Hello <span class=\"text-bold\">%s</span>": "Bonjour <span class=\"text-bold\">%s</span>", + }) + + result := render(t, Tr("fr-FR", "Hello <span class=\"text-bold\">%s</span>", "John")) + assert.Equal(t, "Bonjour <span class=\"text-bold\">John</span>", result) +} + // render is a test helper that renders a component and returns the result as a string func render(t *testing.T, c templ.Component) string { t.Helper() |
