Skip to content

Commit 9517b52

Browse files
committed
htmx 2.0.6
1 parent 4f0d750 commit 9517b52

File tree

2 files changed

+204
-0
lines changed

2 files changed

+204
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2002-2025 Gargoyle Software Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* https://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
package org.htmlunit.libraries;
16+
17+
import org.htmlunit.WebClient;
18+
import org.htmlunit.javascript.preprocessor.HtmxTwoZeroSevenScriptPreProcessor;
19+
import org.htmlunit.junit.annotation.Alerts;
20+
import org.htmlunit.junit.annotation.HtmlUnitNYI;
21+
import org.junit.jupiter.api.Test;
22+
23+
/**
24+
* Tests for <a href="https://htmx.org/">htmx</a>.
25+
*
26+
* @author Ronald Brill
27+
*/
28+
public class HtmxTest2x0x6 extends HtmxTest {
29+
30+
/**
31+
* @throws Exception if an error occurs
32+
*/
33+
@Test
34+
@Alerts(DEFAULT = "passes:727failures:1",
35+
FF = "passes:722failures:2",
36+
FF_ESR = "passes:722failures:2")
37+
@HtmlUnitNYI(
38+
CHROME = "passes:696failures:21",
39+
EDGE = "passes:696failures:21",
40+
FF = "passes:709failures:17",
41+
FF_ESR = "passes:709failures:17")
42+
public void htmx() throws Exception {
43+
htmx("htmx-2.0.6", false);
44+
}
45+
46+
/**
47+
* @throws Exception if an error occurs
48+
*/
49+
@Test
50+
@Alerts(DEFAULT = "passes:624failures:104",
51+
FF = "passes:625failures:99",
52+
FF_ESR = "passes:625failures:99")
53+
@HtmlUnitNYI(
54+
CHROME = "passes:596failures:119",
55+
EDGE = "passes:596failures:119",
56+
FF = "passes:614failures:110",
57+
FF_ESR = "passes:614failures:110")
58+
public void htmxMin() throws Exception {
59+
htmx("htmx-2.0.6", true);
60+
}
61+
62+
@Override
63+
protected void setupWebClient(final WebClient webClient) {
64+
super.setupWebClient(webClient);
65+
66+
webClient.setScriptPreProcessor(new HtmxTwoZeroSevenScriptPreProcessor());
67+
webClient.getOptions().setThrowExceptionOnScriptError(false);
68+
}
69+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="utf-8" />
4+
<title>Mocha Tests</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
7+
<meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" />
8+
<meta http-equiv="cache-control" content="max-age=0" />
9+
<meta http-equiv="expires" content="0" />
10+
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
11+
<meta http-equiv="pragma" content="no-cache" />
12+
<meta name="htmx-config" content='{"historyEnabled":false,"defaultSettleDelay":0}'>
13+
</head>
14+
<body style="padding:20px;font-family: sans-serif">
15+
16+
<h1 style="margin-top: 40px">htmx.js test suite</h1>
17+
<p id="version-number">Version:&nbsp;</p>
18+
19+
<h2>Scratch Page</h2>
20+
<ul>
21+
<li>
22+
<a href="scratch/scratch.html">Scratch Page</a>
23+
</li>
24+
</ul>
25+
26+
<h2>Manual Tests</h2>
27+
<a href="manual/">Here</a>
28+
29+
<h2>Mocha Test Suite</h2>
30+
<a href="index.html">[ALL]</a>
31+
32+
<script src="../node_modules/chai/chai.js"></script>
33+
<script src="../node_modules/chai-dom/chai-dom.js"></script>
34+
<script src="../node_modules/mocha/mocha.js"></script>
35+
<script src="../node_modules/sinon/pkg/sinon.js"></script>
36+
<script src="../node_modules/mock-socket/dist/mock-socket.js"></script>
37+
<script src="../src/htmx.min.js"></script>
38+
<script>
39+
// Do not log all the events in headless mode (the log output is enormous)
40+
if (navigator.webdriver) {
41+
htmx.logAll = function () { }
42+
}
43+
44+
// Add the version number to the top
45+
document.getElementById('version-number').innerText += htmx.version
46+
</script>
47+
48+
<script class="mocha-init">
49+
mocha.setup({
50+
ui: "bdd",
51+
timeout: 4000,
52+
rootHooks: {
53+
beforeEach(done) {
54+
console.log(`${this?.currentTest?.parent?.title} - ${this?.currentTest?.title}`)
55+
done()
56+
},
57+
},
58+
})
59+
mocha.checkLeaks();
60+
window.should = window.chai.should()
61+
</script>
62+
63+
<script src="util/util.js"></script>
64+
65+
<!-- core tests -->
66+
<script src="core/internals.js"></script>
67+
<script src="core/api.js"></script>
68+
<script src="core/ajax.js"></script>
69+
<script src="core/config.js"></script>
70+
<script src="core/verbs.js"></script>
71+
<script src="core/parameters.js"></script>
72+
<script src="core/headers.js"></script>
73+
<script src="core/regressions.js"></script>
74+
<script src="core/security.js"></script>
75+
<!-- HtmlUnit shadowdom not supported so far script src="core/shadowdom.js"></script -->
76+
<script src="core/perf.js"></script>
77+
<script src="core/validation.js"></script>
78+
<script src="core/tokenizer.js"></script>
79+
<script src="core/extensions.js"></script>
80+
<script src="core/extension-swap.js"></script>
81+
82+
<!-- attribute tests -->
83+
<script src="attributes/hx-boost.js"></script>
84+
<script src="attributes/hx-confirm.js"></script>
85+
<script src="attributes/hx-delete.js"></script>
86+
<script src="attributes/hx-ext.js"></script>
87+
<script src="attributes/hx-get.js"></script>
88+
<script src="attributes/hx-headers.js"></script>
89+
<script src="attributes/hx-history.js"></script>
90+
<script src="attributes/hx-history-elt.js"></script>
91+
<script src="attributes/hx-include.js"></script>
92+
<script src="attributes/hx-indicator.js"></script>
93+
<script src="attributes/hx-disabled-elt.js"></script>
94+
<script src="attributes/hx-inherit.js"></script>
95+
<script src="attributes/hx-disinherit.js"></script>
96+
<script src="attributes/hx-on-wildcard.js"></script>
97+
<script src="attributes/hx-params.js"></script>
98+
<script src="attributes/hx-patch.js"></script>
99+
<script src="attributes/hx-post.js"></script>
100+
<script src="attributes/hx-preserve.js"></script>
101+
<script src="attributes/hx-prompt.js"></script>
102+
<script src="attributes/hx-push-url.js"></script>
103+
<script src="attributes/hx-put.js"></script>
104+
<script src="attributes/hx-replace-url.js"></script>
105+
<script src="attributes/hx-request.js"></script>
106+
<script src="attributes/hx-select.js"></script>
107+
<script src="attributes/hx-select-oob.js"></script>
108+
<script src="attributes/hx-swap-oob.js"></script>
109+
<script src="attributes/hx-swap.js"></script>
110+
<script src="attributes/hx-sync.js"></script>
111+
<script src="attributes/hx-target.js"></script>
112+
<script src="attributes/hx-trigger.js"></script>
113+
<script src="attributes/hx-vals.js"></script>
114+
<script src="attributes/hx-vars.js"></script>
115+
116+
<!-- this hyperscript integration should be removed once its removed from the tests -->
117+
<script src="lib/_hyperscript.js"></script>
118+
119+
<!-- events last so they don't screw up other tests -->
120+
<script src="core/events.js"></script>
121+
122+
<div id="mocha"></div>
123+
124+
<script class="mocha-exec">
125+
document.addEventListener("DOMContentLoaded", function () {
126+
mocha.run();
127+
})
128+
</script>
129+
<div hx-trigger="restored" hidden>just for htmx:restored event testing</div>
130+
<em>Work Area</em>
131+
<hr/>
132+
<div id="work-area" hx-history-elt>
133+
</div>
134+
</body>
135+
</html>

0 commit comments

Comments
 (0)