htmx v2-beta4 #12

Merged
danieljsummers merged 2 commits from v2-beta4 into main 2024-05-23 23:30:59 +00:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 32e962416d - Show all commits

View File

@ -811,6 +811,12 @@ let attributes =
test "_hxWs succeeds" { test "_hxWs succeeds" {
ul [ _hxWs "connect:/web-socket" ] [] |> shouldRender """<ul hx-ws="connect:/web-socket"></ul>""" ul [ _hxWs "connect:/web-socket" ] [] |> shouldRender """<ul hx-ws="connect:/web-socket"></ul>"""
} }
test "_sseSwap succeeds" {
ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """<ul sse-swap="sseMessageName"></ul>"""
}
test "_sseConnect succeeds" {
div [ _sseConnect "/gps/sse" ] [] |> shouldRender """<div sse-connect="/gps/sse"></div>"""
}
] ]
/// Tests for the Script module /// Tests for the Script module

View File

@ -317,6 +317,7 @@ module HxVals =
/// Create values from a list of key/value pairs /// Create values from a list of key/value pairs
let From = toJson let From = toJson
/// Attributes and flags for htmx /// Attributes and flags for htmx
[<AutoOpen>] [<AutoOpen>]
module HtmxAttrs = module HtmxAttrs =
@ -438,6 +439,12 @@ module HtmxAttrs =
/// Establishes a WebSocket or sends information to one /// Establishes a WebSocket or sends information to one
let _hxWs = attr "hx-ws" let _hxWs = attr "hx-ws"
/// The name of the message to swap into the DOM.
let _sseSwap = attr "sse-swap"
/// The URL of the SSE server.
let _sseConnect = attr "sse-connect"
/// Script tags to pull htmx into an web page /// Script tags to pull htmx into an web page
module Script = module Script =