From 8d06e4c95a8329182525607545f2854ba0adfe00 Mon Sep 17 00:00:00 2001
From: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
Date: Tue, 24 Oct 2023 16:59:53 -0700
Subject: [PATCH] Add `Link` element
---
elements.go | 4 ++++
elements_test.go | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/elements.go b/elements.go
index 25b2884..5043cae 100644
--- a/elements.go
+++ b/elements.go
@@ -144,6 +144,10 @@ func Img(props Attrs) *Element {
// ========== Meta Elements ==========
+func Link(props Attrs) *Element {
+ return NewElement("link", props)
+}
+
func Meta(props Attrs) *Element {
return NewElement("meta", props)
}
diff --git a/elements_test.go b/elements_test.go
index 7600e50..865bfa5 100644
--- a/elements_test.go
+++ b/elements_test.go
@@ -202,6 +202,18 @@ func TestImg(t *testing.T) {
// ========== Meta Elements ==========
+func TestLink(t *testing.T) {
+ expected := ``
+ el := Link(Attrs{attrs.Rel: "stylesheet", attrs.Href: "https://example.com/styles.css"})
+ assert.Equal(t, expected, el.Render())
+}
+
+func TestMeta(t *testing.T) {
+ expected := ``
+ el := Meta(Attrs{attrs.Charset: "UTF-8"})
+ assert.Equal(t, expected, el.Render())
+}
+
func TestScript(t *testing.T) {
expected := ``
el := Script(Attrs{attrs.Src: "https://example.com/script.js"})