16 Commits

Author SHA1 Message Date
MichaelWest22
84306ccf3d
Fix non chrome view transtions tests (#3338)
fix non chrome view transitions tests
2025-06-19 15:02:11 -06:00
MichaelWest22
859708c379
move delay and view transitions to inside swap function for api and history use (#3328)
* move delay and view transitions to inside swap function

* Fix indenting and add tests

* move delay and view transitions to inside swap function

* Fix indenting and add tests

* revert rollback of feat: handle 'unset'for HX-Reselect in swap function
2025-06-16 17:31:07 -05: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
p.b
d1fc7895f6
Add textContent swap style (#2356)
* feat: add textContent swap style

* add documentation

---------

Co-authored-by: pbt <pb.to@icloud.com>
2024-02-29 11:11:46 -05:00
Alexander Petros
4b890ce72d Run linter on the tests too 2023-12-21 13:22:10 -05:00
Thomas Cowart
078d5da5b4
Update parseInterval to handle "0" correctly (#1835)
* Update parseInterval to handle "0" correctly

When a parameter like "0ms" is passed in to parseInterval it gets parsed to 0.
Previously this would result in a return value of "undefined" because 0 is falsy
and thus the `return 0 || undefined` statements return undefined.

The purpose of the form `parseFloat(str) || undefined` was to return "undefined" if
parseFloat failed (parseFloat returns NaN, a falsy value, if it can't parse its
argument). Unfortunately, as mentioned, parseFloat can also succeed and return a
falsy value -- when the argument is "0" (or "0.0", etc.). So the new code, rather
than depending on the falsiness of the result of parseFloat, explicitly checks for
a NaN.

* Adds some semicolons

Adds some semicolons to parseInterval (and tests) for consistency.

* Add one more parseInterval test for "0"

Adds test test to make sure parseInterval works on "0".

* Adds functional tests for every, swap, settle, throttle, and delay

* Explcitly check that setTimeout values are > 0

These values come from user settings that are read from parseInterval,
so they could be a number or undefined.

If the value being checked is > 0 setTimeout will be called with some
associated function. If the value is 0 or 'undefined' the associated function
will be called immediately ('undefined' is not greater than 0).

* Change '!== undefined' to '> 0'

`pollInterval !== undefined` is a subtly different conditional than just `pollInterval` or `pollInterval > 0` (which are equivalent). Changes the conditional to `pollInterval > 0` so as to not change the behavior but also be more explicit in the test.
2023-12-20 15:46:04 -07:00
Sascha Woo
f15795e79c
Allow hx-swap options to be used without specifying modifier (innerHTML remains the default) (#1455)
* hx-swap: make swap style optional

* hx-swap: log an error when an unknown option or modifier is used
2023-09-14 10:57:30 -06:00
Carson Gross
c230931d42 support ability to ignore new title tags via config, event and hx-swap 2023-08-31 10:54:47 -06:00
carson
636fd1b902 fix tests + add test for https://github.com/bigskysoftware/htmx/pull/214 2022-01-14 12:54:28 -07:00
Arham Jain
5045534d26 added two simple tests for delete mode 2021-11-24 21:23:35 -05:00
carson
835436a99b Multiple trigger issue - fix https://github.com/bigskysoftware/htmx/issues/392 and https://github.com/bigskysoftware/htmx/issues/390
Mark handling by element, rather than by event
introduce `consume` keyword on trigger to allow for preventing it from bubbling to parent
2021-02-27 20:01:39 -07:00
carson
445e6e2b4d do not trigger after swap events and logic on element that has been removed by outerHTML swap 2021-01-23 15:50:28 -07:00
carson
4ef719e63a support hx-swap="none"
fixes https://github.com/bigskysoftware/htmx/issues/89
2020-06-11 06:02:23 -07:00
carson
7036557cba oob swapping fixes and firm up the settle step quite a bit 2020-05-25 16:34:19 -07:00
carson
ba6d38e9dd Fix https://github.com/bigskysoftware/htmx/issues/19
clean up uses of getRawAttribute() and add a `data-*` test for all attribute tests.
2020-05-23 04:52:52 -07:00
carson
3aa8c64754 le big re-rename 2020-05-17 05:22:19 -07:00