668 Commits

Author SHA1 Message Date
Carson Gross
15c69b141b pain 2024-01-25 21:06:50 -07:00
Vincent
01b292ada4 FormData + web component & parameters order tests
#1323 #1686 #2034 #1895
2024-01-25 11:05:53 +01: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
Carson Gross
fd775f84be fix version and lint 2024-01-23 12:53:58 -07:00
Carson Gross
1023193b01 fix script tag double execution 2024-01-23 12:48:39 -07:00
Carson Gross
0a2c375970 Merge remote-tracking branch 'origin/v2.0v2.0' into v2.0v2.0 2024-01-23 12:16:08 -07:00
Denis Palashevskii
7fe27dd275
Refactor and expose swap in public API (#2191)
* refactor and expose swapping as a single method

* fixes after rebasing on latest 2.0

* fix optional parameters for swapping

* add `fullSwap` to internal API

* swap refactor polishing

* make linter happy
2024-01-19 16:31:34 -07:00
Alexander Petros
0e67ac8081 Format tests 2024-01-18 10:20:34 -05:00
Carson Gross
3fa7df1d23 Merge branch 'dev' into v2.0v2.0
# Conflicts:
#	dist/ext/sse.js
#	dist/htmx.d.ts
#	dist/htmx.js
#	dist/htmx.min.js
#	dist/htmx.min.js.gz
#	src/htmx.js
#	test/core/parameters.js
#	www/content/docs.md
2024-01-15 14:26:50 -07:00
Neel Raja
ac1d3f816f
Fix SSE tests and emit new "beforeMessage" event for SSE Extension (#2171)
* Emit htmx:sseBeforeMessage

* Add tests and respect cancels

* Fix syntax errors

* fix other syntax error

* finally fix these tests!
2024-01-15 14:19:00 -07:00
Alexander Petros
4e7baa3405 Remove libs for extension tests 2024-01-13 14:17:52 -05:00
Alexander Petros
569c29cb4e Remove test/ext files
This causes the timing issue in the shadow dom tests to reappear again.
2024-01-13 14:17:11 -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
Alexander Petros
172fb88972 Skip leaky shadowdom test 2024-01-13 12:21:33 -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
d2d22c2903 restore old semantics w/ body returning its children 2023-12-27 19:10:35 -07:00
Carson Gross
ff96b78e77 move to template parsing by default (prep for head support) 2023-12-27 14:42:14 -07:00
Carson Gross
8c61e71940 support revealed paired w/ other events 2023-12-26 16:42:16 -07:00
Carson Gross
9fbbd17672 reformat 2023-12-24 16:37:51 -07:00
Carson Gross
3903e51672 fix up after merge 2023-12-24 15:33:09 -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
adbdc71c81 add another test for inheritance disabling 2023-12-24 15:06:11 -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
Carson Gross
66599ef887 Merge branch 'master' into dev
# Conflicts:
#	www/content/docs.md
2023-12-21 17:28:58 -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
Vincent
b9da68d970
Support encapsulating oob swap elements in templates in response (#2120) 2023-12-21 12:39:23 -07:00
Alexander Petros
f4f35aec76 Format the rest of tests 2023-12-21 13:26:41 -05:00
Alexander Petros
290a78f6b0 Fix delete statement in two tests 2023-12-21 13:25:46 -05:00
Alexander Petros
4b890ce72d Run linter on the tests too 2023-12-21 13:22:10 -05:00
Carson Gross
41e9ce3593 Merge branch 'dev' into v2.0v2.0 2023-12-20 15:48:47 -07:00
Carson Gross
b4080e71da remove psychotic test 2023-12-20 15:48:31 -07: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
Fernando Comunello
e9bce8db65
Improve head tag parsing on template fragments (#2024)
Fix https://github.com/bigskysoftware/htmx/issues/2018
2023-12-20 15:37:42 -07:00
Carson Gross
46a1502a84 fix the shadow root tests interfering w/ other tests 2023-12-20 13:45:13 -07: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
Vincent
4057f9c465
Trigger specs cache indentation fix + documentation & tests (#2094)
* Fix parseAndCacheTrigger indentation as discussed in #1540

https://github.com/bigskysoftware/htmx/pull/1540#issuecomment-1834651800

* Trigger specs cache documentation + tests
2023-12-14 11:44:11 -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
Carson Gross
22fde35674 Merge branch 'dev' into v2.0v2.0 2023-12-13 14:46:37 -07:00
Carson Gross
3be4202e5e add support for dashes in hx-on* attributes 2023-12-07 15:15:10 -07:00
Katrina Scialdone
edc31073a7 Add tests for new extended selector syntax 2023-12-07 08:58:28 -07:00
Katrina Scialdone
4d9adabe6c Make shadow DOM tests actually pass 2023-12-07 08:48:20 -07:00
Katrina Scialdone
5f92e2cc92 Add shadow DOM tests 2023-12-07 08:07:00 -07:00