Update for htmx 1.7.0 #4
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.6.1</VersionPrefix>
|
||||
<PackageReleaseNotes>Initial production-ready release</PackageReleaseNotes>
|
||||
<VersionPrefix>1.7.0</VersionPrefix>
|
||||
<PackageReleaseNotes>Support new attributes/headers in htmx 1.7.0</PackageReleaseNotes>
|
||||
<Authors>danieljsummers</Authors>
|
||||
<Company>Bit Badger Solutions</Company>
|
||||
<PackageProjectUrl>https://github.com/bit-badger/Giraffe.Htmx</PackageProjectUrl>
|
||||
|
@ -217,6 +217,17 @@ module HandlerTests =
|
||||
Assert.Equal ("/a-new-url", dic.["HX-Push"].[0])
|
||||
}
|
||||
|
||||
[<Fact>]
|
||||
let ``withHxNoPush succeeds`` () =
|
||||
let ctx = Substitute.For<HttpContext> ()
|
||||
let dic = HeaderDictionary ()
|
||||
ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore
|
||||
task {
|
||||
let! _ = withHxNoPush next ctx
|
||||
Assert.True (dic.ContainsKey "HX-Push")
|
||||
Assert.Equal ("false", dic.["HX-Push"].[0])
|
||||
}
|
||||
|
||||
[<Fact>]
|
||||
let ``withHxRedirect succeeds`` () =
|
||||
let ctx = Substitute.For<HttpContext> ()
|
||||
|
@ -66,6 +66,10 @@ module Handlers =
|
||||
let withHxPush : string -> HttpHandler =
|
||||
setHttpHeader "HX-Push"
|
||||
|
||||
// Explicitly do not push a new URL into the history stack
|
||||
let withHxNoPush : HttpHandler =
|
||||
toLowerBool false |> withHxPush
|
||||
|
||||
/// Can be used to do a client-side redirect to a new location
|
||||
let withHxRedirect : string -> HttpHandler =
|
||||
setHttpHeader "HX-Redirect"
|
||||
|
@ -344,6 +344,10 @@ module Attributes =
|
||||
let ``_hxDisable succeeds`` () =
|
||||
p [ _hxDisable ] [] |> shouldRender """<p hx-disable></p>"""
|
||||
|
||||
[<Fact>]
|
||||
let ``_hxDisinherit succeeds`` () =
|
||||
strong [ _hxDisinherit "*" ] [] |> shouldRender """<strong hx-disinherit="*"></strong>"""
|
||||
|
||||
[<Fact>]
|
||||
let ``_hxEncoding succeeds`` () =
|
||||
form [ _hxEncoding "utf-7" ] [] |> shouldRender """<form hx-encoding="utf-7"></form>"""
|
||||
@ -425,6 +429,10 @@ module Attributes =
|
||||
let ``_hxSwapOob succeeds`` () =
|
||||
li [ _hxSwapOob "true" ] [] |> shouldRender """<li hx-swap-oob="true"></li>"""
|
||||
|
||||
[<Fact>]
|
||||
let ``_hxSync succeeds`` () =
|
||||
nav [ _hxSync "closest form:abort" ] [] |> shouldRender """<nav hx-sync="closest form:abort"></nav>"""
|
||||
|
||||
[<Fact>]
|
||||
let ``_hxTarget succeeds`` () =
|
||||
header [ _hxTarget "#somewhereElse" ] [] |> shouldRender """<header hx-target="#somewhereElse"></header>"""
|
||||
|
@ -164,6 +164,8 @@ module HtmxAttrs =
|
||||
let _hxDelete = attr "hx-delete"
|
||||
/// Disables htmx processing for the given node and any children nodes
|
||||
let _hxDisable = flag "hx-disable"
|
||||
/// Disinherit all ("*") or specific htmx attributes
|
||||
let _hxDisinherit = attr "hx-disinherit"
|
||||
/// Changes the request encoding type
|
||||
let _hxEncoding = attr "hx-encoding"
|
||||
/// Extensions to use for this element
|
||||
@ -204,6 +206,8 @@ module HtmxAttrs =
|
||||
let _hxSwap = attr "hx-swap"
|
||||
/// Marks content in a response as being "Out of Band", i.e. swapped somewhere other than the target
|
||||
let _hxSwapOob = attr "hx-swap-oob"
|
||||
/// Synchronize events based on another element
|
||||
let _hxSync = attr "hx-sync"
|
||||
/// Specifies the target element to be swapped
|
||||
let _hxTarget = attr "hx-target"
|
||||
/// Specifies the event that triggers the request
|
||||
|
Loading…
Reference in New Issue
Block a user