Skip to content

API reference

Docs versioning follows create-pleyn (the product entrypoint).

Package Version
create-pleyn 0.1.0
htmx-contract 0.1.0

Public entry points of htmx-contract@0.1.0.

Import Module
htmx-contract ./index.ts
htmx-contract/fixtures ./fixtures.ts
htmx-contract/inspect ./inspect.ts
htmx-contract/poll ./poll.ts
htmx-contract/rules ./rules.ts
htmx-contract/swap ./swap.ts
Symbol Role
checkDocument(html, options?) Is this rendered page self-consistent?
checkResponse(options) Would this response, swapped into that page, do damage?
swapAndCheck(options) Apply the modelled swap and return { html, violations }.
formatViolations(violations) Human-readable violation text for test failures.
RULES The rule list (also the docs sync source).

Assert on the DOM after the swap, not on the response body. The response body is not what the user ends up looking at.