Skip to content

Commit

Permalink
Htmx attribute test
Browse files Browse the repository at this point in the history
  • Loading branch information
daharon committed Jun 15, 2024
1 parent ec93989 commit e7c2a81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 14 additions & 0 deletions zio-http-htmx/src/test/scala/zio/http/htmx/HtmxSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package zio.http.htmx

import zio.http.template.button
import zio.test.{ZIOSpecDefault, assertTrue}

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)
},
)
}

0 comments on commit e7c2a81

Please sign in to comment.