120 Commits

Author SHA1 Message Date
MichaelWest22
508e332544
Standardize history restore functions to use proper htmx swap functions (#3306)
* Improve history support and events

* Improve history event overrides

* Improve history support and events

* Improve history event overrides

* Update Documentation of new event changes

* Add event testing for updated events

* update event doco and rename to historyElt to be consistent

* Improve history support and events

* Improve history event overrides

* Update Documentation of new event changes

* Add event testing for updated events

* update event doco and rename to historyElt to be consistent

* Fix loc coverage test coverage

* Standardize history restore functions to use proper htmx swap functions

* Add test for hx-history-elt attribute

* Fix broken merge conflict resolution
2025-06-16 16:53:57 -06:00
MichaelWest22
24a0106f76
Update testing framework to web-test-runner and improve code coverage (#3273)
* Fix old npm dependencies

* implement web-test-runner tests for headless alongside Mocha browser tests

* Increase test and code coverage

* update to 100% coverage and impove eslint

* Update testing Doco

* revert all htmx changes and updates/disable tests needed

* fix browser mocha test

* Default testing to use playwrite only instead of puppeter

* playwright install fix

* Imporve test summary reporting

* flatten false looks closer to original
2025-04-17 17:55:43 -06:00
Carson Gross
2bab9f4160 Merge branch 'dev' into v2.0v2.0
# Conflicts:
#	dist/ext/sse.js
#	dist/ext/ws.js
#	dist/htmx.d.ts
#	dist/htmx.js
#	dist/htmx.min.js
#	dist/htmx.min.js.gz
#	package.json
#	src/ext/sse.js
#	src/htmx.d.ts
#	src/htmx.js
#	test/attributes/hx-sse.js
#	test/core/regressions.js
#	test/ext/sse.js
#	www/static/src/ext/sse.js
#	www/static/src/htmx.d.ts
#	www/static/src/htmx.js
#	www/static/test/attributes/hx-sse.js
#	www/static/test/core/regressions.js
#	www/static/test/ext/sse.js
#	www/themes/htmx-theme/static/js/htmx.js
2024-03-14 09:11:36 -06:00
Carson Gross
c16758a198 alpha2 2024-02-09 11:13:47 -07:00
Daniel Nieto
5b4fb817d6
Add trailing slash to manual tests link (#2241)
add trailing slash to correctly link individual manual tests
2024-01-24 10:03:31 -05:00
Alexander Petros
7405e52895 Remove hyperscript tests 2024-01-13 14:12:37 -05:00
Alexander Petros
a49a98a991 Move extension-swap test and delete extension tests 2024-01-13 14:06:54 -05:00
Carson Gross
8b59cb9383 docs + config of head handling 2024-01-05 13:11:30 -07:00
Carson Gross
5cdd50ebbe fix test 2024-01-05 11:00:08 -07:00
Carson Gross
0e61b21440 Merge branch 'v2.0v2.0' into config-return-behavor
# Conflicts:
#	src/htmx.js
2023-12-24 15:17:53 -07:00
Carson Gross
42668c6df7 Merge branch 'v2.0v2.0' into disable-inheritance
# Conflicts:
#	src/htmx.js
#	www/content/docs.md
2023-12-24 14:55:11 -07:00
Vincent
23d473291d
Updated mocha, tests now work with node 20 (#2122)
* Updated mocha, tests now work with node 20

* Update package-lock.json

* Enable Node CI for v2.0v2.0 branch (#2123)

Run tests for v2.0v2.0 branch too

* Bump CI's node version to 20.x
2023-12-21 16:54:02 -05:00
Carson Gross
7c1c406efc Merge branch 'v2.0v2.0' into merge-2075
# Conflicts:
#	src/htmx.js
2023-12-20 13:22:49 -07:00
Denis Palashevskii
23256373fc
Remove legacy WS/SSE code (#2095)
* apply updated patch with legacy WS/SSE removal

* remove legace WS/SSE from the test server also

* remove sse mention from getTriggerSpec()

* clean up sse.js implementation after removal of hx-sse
2023-12-14 15:54:16 -07:00
Carson Gross
0eb8190342 Merge branch 'dev' into v2.0v2.0 2023-12-14 14:34:29 -07:00
fhp-mec
11cef8ee83
Fix: Make the SSE extension work properly and adhere to tests (#2025)
* Process sse-swap properly when swapped in

Previously `sse-swap` were only processed when `sse-connect` was on the
root of what was being swapped in.
This is now fixed so that the closest sseEventSource is found and used as the
event source

* Pass for code readabiltiy

remove the nested if statements as there is no difference in handling
between sseURL and LegacySSEUrl.

* Fix indenting

* Initial attempt at sse extension tests

* Make existing tests pass

* Add test case for #916

* backport test for #916 to hx-sse for completeness

* add a distinct test for sse-swap

* more tests, fix tests

+ more tests differentiating the implementation of sse-swap and
hx-trigger
* fix for "is closed after removal with no close and activity"

* Cleanup listener if element is gone

* Revert "Cleanup listener if element is gone"

This reverts commit bbe3715276302656d1a422fbc4778842776e35f6.

* Clean up listeners if element gone, fix indenting

* Incorportate feedback from first review

+ seperate eventSource creation logic and event registering logic
+ manually create event handling, still confused by how hx-trigger works
* `createEventSourceOnElement` now looks for event sources in children
* explicitly handle legacy sse handling instead of having extra
  selectors in `querySelectorOnThisOrChildren`
+ a few readability changes
+ add regression check to make sure that sseEventSource is only created
  on elements with sse-connect or equivalent
+ add test to make sure that sse-connect in the child of a swapped
  element is handled

* Allow multiple listeners in eventsource mock

* Backport eventsource mocks to legacy tests

---------

Co-authored-by: 1cg <469183+1cg@users.noreply.github.com>
2023-12-14 14:33:38 -07:00
Carson Gross
b9dbbf52ca Merge branch 'v2.0v2.0' into config-return-behavor
# Conflicts:
#	src/htmx.js
2023-12-14 11:59:14 -07:00
Jyri-Matti Lähteenmäki
7866258936
add extension to populate path variables with request parameters (#1307)
* add extension to populate path variables with request parameters

* update extension readme
2023-12-13 18:31:28 -07:00
Carson Gross
ad871a9576 Merge branch 'v2.0v2.0' into disable-inheritance
# Conflicts:
#	src/htmx.js
2023-12-13 17:08:52 -07:00
Carson Gross
cd176d61d7 remove legacy hx-on= syntax 2023-12-13 14:59:48 -07:00
Katrina Scialdone
5f92e2cc92 Add shadow DOM tests 2023-12-07 08:07:00 -07:00
Vincent
200c503f31
Removed IE-specific tests (#2039) 2023-11-24 11:30:11 -05:00
Carson Gross
69c053c136 initial inheritance disabling work 2023-11-14 16:27:49 -07:00
Carson Gross
3287445049 make response handling configurable 2023-11-14 14:03:14 -07:00
Vincent
8ddd079b90
IE11 compatibility fixes (#1948) 2023-11-02 16:40:33 -06:00
matiboy
712ee759f1
Fix confirmed being ignored in htmx:confirm event (#1610)
* Current behavior testing

Testing current library behavior

* Test should remove correct handler

* Add question in htmx:confirm event detail

* Allow skipping window.confirm

* Additional test without hx-confirm value

* Wrap htmx.off in finally

* More correct assertion in case of no calls to confirm

* Remove erroneously added formatting

* Remove erroneously added formatting

* Documentation, fix loop

---------

Co-authored-by: mat <matt@techspace.asia>
2023-10-26 14:43:41 -06:00
Carson Gross
a5fd1b7081 make singular to make more consistent w/ other attributes 2023-09-21 16:57:28 -06:00
Carson Gross
aa7ae144b5 Merge branch 'master' into dev 2023-09-21 15:48:07 -06:00
Sascha Woo
32b58c41cb
Add support for event cancellation (preventDefault) in extensions (#1456)
ext: add support for event cancellation via preventDefault()
2023-09-21 15:44:42 -06:00
Vincent
bb5413dfd2
[Tests] Fix test pipeline timing issues (#1818)
Fix test pipeline timing issues
2023-09-21 15:43:49 -06:00
Alexander Petros
03b1ebea97
Add version number to test page (#1813)
Now that we only have a single test page, it's helpful to show which
version of htmx the tests are running against.
2023-09-21 12:11:40 -06:00
Carson Gross
af0dc9c352 add hx-disabled-elts functionality 2023-09-14 13:20:46 -06:00
Vincent
55c30b5607
Make htmx IE11 compatible again + tests IE11 compatible (#1687)
* Make htmx IE11 compatible again + tests IE11 compatible

* IE11 compatible handmade socket mock for ws-ext tests

* Fallback when xpath isn't supported, hx-on wildcard now working on IE11

* Merge remote-tracking branch 'upstream/relative-url-in-hx-boost' into ie11-compatibility
2023-09-06 09:55:18 -06:00
Alexander Petros
bfd7965dec
Disable logAll in headless mode (#1673)
Enabling logAll in just one test has the capacity to overwhelm the CI
with log output, so we disable it if the webdriver is automated.
2023-08-06 18:06:17 -06:00
Carson Gross
05a1f8cba7 Merge remote-tracking branch 'origin/dev' into dev 2023-07-14 13:50:31 -06:00
Alexander Petros
adef1166e2
Add support for hx-on:* attribute (#1489)
* Add support for hx-on:* attribute

* Use shorter XPath selector

* Add support for "hx-on::" shorthand

* Add note about mixing the two forms of `hx-on`
2023-06-13 09:23:16 -06:00
Paweł Wilk
7fc5ac5074
response-targets extension with documentation, exposed 3 functions in internal API (#1436)
* findThisElement, getClosestAttributeValue, querySelectorExt exposed in internal API

* Added response-targets extension.

* Extra check for empty element in response-targets.js

* Added test/ext/response-targets.js

* Linked response-targets.md

* Added htmx.config.{responseTargetPrefersExisting, responseTargetPrefersRetargetHeader} configuration options

* Typo fixed (not impacting logic)
2023-05-23 09:46:54 -05:00
Carson Gross
b4e6c5cbd5 hx-on attribute 2023-03-31 06:44:01 -06:00
Carson Gross
d20919ad6c release cleanup 2023-03-02 16:46:48 -07:00
Carson Gross
30f762aa47 Merge branch 'master' into dev 2022-12-06 13:10:58 -07:00
Mark Croxton
4419bc4c90
History cache embargo (#1113)
* Add hx-history="false" to prevent sensitive or session data entering the localStorage cache

* Correctly get value of hx-history attribute.

* Add test for hx-history attribute.

* Allow history cache to be disabled when multiple `hx-history` attributes are present in a document, and any one of them is set to false.

* Add documentation for `hx-history` attribute.

* Add `hx-history` attribute to reference doc

* Correct the order of the `hx-history` attr in the reference doc.
2022-12-03 16:56:15 -06:00
Denis Palashevskii
36b017bc26
Add events support for WebSockets (#1126)
* Add events support for WebSockets

* Stop reconnection attempts after element has been removed

* Add tests for websockets

* Hide socker wrapper behind a more strict interface to avoid breaking changes in the future

* Fix legacy websocket tests interfering with new extension tests

* Minor doc fixes

* Add `wsBinaryType` configuration option
2022-12-03 16:53:59 -06:00
Ján Regeš
34582b839c
extensions: added new extension 'multi-swap' with mocha tests and docs (#1096)
* extensions: added new extension 'multi-swap' with mocha tests and docs

* multi-swap extension: removed forgotten debug console.log()

* multi-swap extension: removed forgotten debug comment from mocha test
2022-10-23 08:59:03 -06:00
Carson Gross
05619c5bec support the hx-select-oob attribute 2022-05-31 13:30:34 -06:00
David Guillot
be85c2c191
feat(ext): add disable-element extension (#869)
* feat(ext): add disable-element extension

* fixup! feat(ext): add disable-element extension
2022-04-08 13:13:03 -06:00
Denis Palashevskii
70b4ad16f0
Add data-loading-aria-busy directive for loading-states extension (#864)
* Add data-loading-aria-busy directive for loading-states extension; add tests for the extension

* Update docs

* Fix tests of scoped loading states

* Commit test files

* Improve delay tests by using sinon timer

* Add reference to MDN about `aria-busy` attribute
2022-04-07 13:34:41 -06:00
Ben Pate
546e346e98
Restore hx-ws and hx-sse tags (#811)
absolute 👑 

* Restore WS and SSE code

First pass at restoring removed ws and sse code.  More to come.

* More progress on WS and SSE restore

* Update htmx.js

crucial whitespace

* Update documentation

* Combine SSE and WS servers into single "realtime" demo

* Realtime Test Server Updates

- separated tests for old- and new- style calling
- updated intro content and stylesheet
- removed extensions from manual test suite

* Remove SSE/WS from manual tests
2022-02-12 11:11:30 -07:00
carson
baa84e7803 get old sse syntax working 2022-02-04 19:16:13 -07:00
carson
c7f4f360d1 Merge branch 'dev' into pull/753
# Conflicts:
#	src/htmx.js
2022-02-04 11:16:59 -07:00
alfonsrv
bce4baa20c Rename hx-inherit to hx-disinherit 2022-01-25 23:27:39 +01:00