From b883516bb66426eca1147c36cf0e34f3126045da Mon Sep 17 00:00:00 2001 From: Johan Lindh Date: Fri, 20 Oct 2023 12:59:19 +0200 Subject: [PATCH] more tests --- uihtml_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/uihtml_test.go b/uihtml_test.go index 9e0f271..958e1c2 100644 --- a/uihtml_test.go +++ b/uihtml_test.go @@ -4,6 +4,7 @@ import ( "fmt" "html/template" "io" + "strings" "testing" "time" @@ -53,7 +54,7 @@ func TestUiHtml_JawsEvent(t *testing.T) { defer close(msgCh) tje := &testJawsEvent{msgCh: msgCh} - id := rq.Register(tje, "attr1", []string{"attr2"}, template.HTML("attr3"), []template.HTML{"attr4"}) + id := rq.Register(Tag("zomg"), tje, "attr1", []string{"attr2"}, template.HTML("attr3"), []template.HTML{"attr4"}) rq.inCh <- wsMsg{Data: "text", Jid: id, What: what.Input} select { @@ -107,5 +108,17 @@ func TestUiHtml_JawsEvent(t *testing.T) { t.Error(s) } } +} +func TestUiHtml_JawsRender_panics(t *testing.T) { + defer func() { + x := recover() + if x == nil { + t.Error("expected panic") + } + if !strings.Contains(x.(string), "called") { + t.Error("wrong panic") + } + }() + (&UiHtml{}).JawsRender(nil, nil, nil) }