diff --git a/build.sbt b/build.sbt index 10bf818f06..ac755ca96e 100644 --- a/build.sbt +++ b/build.sbt @@ -267,6 +267,10 @@ lazy val zioHttpHtmx = (project in file("zio-http-htmx")) .settings( stdSettings("zio-http-htmx"), publishSetting(true), + libraryDependencies ++= Seq( + `zio-test`, + `zio-test-sbt`, + ), ) .dependsOn(zioHttpJVM) diff --git a/zio-http-htmx/src/main/scala/zio/http/htmx/package.scala b/zio-http-htmx/src/main/scala/zio/http/htmx/package.scala new file mode 100644 index 0000000000..69ea6b6cae --- /dev/null +++ b/zio-http-htmx/src/main/scala/zio/http/htmx/package.scala @@ -0,0 +1,3 @@ +package zio.http + +package object htmx extends Attributes diff --git a/zio-http-htmx/src/test/scala/zio/http/htmx/HtmxSpec.scala b/zio-http-htmx/src/test/scala/zio/http/htmx/HtmxSpec.scala new file mode 100644 index 0000000000..8e2ee28681 --- /dev/null +++ b/zio-http-htmx/src/test/scala/zio/http/htmx/HtmxSpec.scala @@ -0,0 +1,15 @@ +package zio.http.htmx + +import zio.test.{ZIOSpecDefault, assertTrue} + +import zio.http.template.button + +case object HtmxSpec extends ZIOSpecDefault { + override def spec = suite("HtmxSpec")( + test("hx-get attribute") { + val view = button(hxGetAttr := "/test", "click") + val expected = """<button hx-get="/test">click</button>""" + assertTrue(view.encode == expected.stripMargin) + }, + ) +}