// Render renders the giving giving lists of views. func (s *SequenceRenderer) Render(m ...string) trees.Markup { root := trees.NewElement(s.Tag, false) attrs.Class(strings.Join(s.Class, " ")).Apply(root) attrs.ID(s.ID).Apply(root) for _, st := range s.stack { st.Render(m...).Apply(root) } return root }
func TestElementPrinter(t *testing.T) { elem := trees.NewElement("bench", false) attrs.ClassName("grid col1").Apply(elem) elems.Div(trees.NewText("thunder")).Apply(elem) classes := &trees.ClassList{} classes.Add("x-icon") classes.Add("x-lock") classes.Apply(elem) res := trees.SimpleElementWriter.Print(elem) tests.Truthy(t, "Contains '<bench'", strings.Contains(res, "<bench")) tests.Truthy(t, "contains '</bench>'", strings.Contains(res, "</bench>")) tests.Truthy(t, "contains 'hash='", strings.Contains(res, "hash=")) tests.Truthy(t, "contains 'uid='", strings.Contains(res, "uid=")) }