1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 21:50:43 +03:00
moar/twin/styles_test.go
johan.walles@gmail.com 14c2351e53 Reset hyperlinks properly to unstyled
Before this change, if you had a hyperlink followed by unstyled text,
moar wouldn't reset the hyperlink property, messing up everything after
it.

With this change in place, that now works as one would expect.

Fixes #169.
2023-12-13 09:26:50 +01:00

18 lines
300 B
Go
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package twin
import (
"strings"
"testing"
"gotest.tools/v3/assert"
)
func TestHyperlinkToNormal(t *testing.T) {
url := "http://example.com"
style := StyleDefault.WithHyperlink(&url)
assert.Equal(t,
strings.ReplaceAll(StyleDefault.RenderUpdateFrom(style), "", "ESC"),
"ESC]8;;ESC\\")
}