Skip to content

Commit

Permalink
feat: add hgroup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Jan 31, 2024
1 parent aa7b327 commit f41e762
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elements.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func H6(attrs attrs.Props, children ...Node) *Element {
return newElement("h6", attrs, children...)
}

// Hgroup creates an <hgroup> element.
func Hgroup(attrs attrs.Props, children ...Node) *Element {
return newElement("hgroup", attrs, children...)
}

// Hr creates an <hr> element.
func Hr(attrs attrs.Props) *Element {
return newElement("hr", attrs)
Expand Down
6 changes: 6 additions & 0 deletions elements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ func TestSection(t *testing.T) {
assert.Equal(t, expected, el.Render())
}

func TestHgroup(t *testing.T) {
expected := `<hgroup><h1>Frankenstein</h1><p>Or: The Modern Prometheus</p></hgroup>`
el := Hgroup(nil, H1(nil, Text("Frankenstein")), P(nil, Text("Or: The Modern Prometheus")))
assert.Equal(t, expected, el.Render())
}

// --- Semantic Form Elements ---

func TestFieldset(t *testing.T) {
Expand Down

0 comments on commit f41e762

Please sign in to comment.