htmx/test/index.html
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

135 lines
4.7 KiB
HTML

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mocha Tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
<meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="htmx-config" content='{"historyEnabled":false,"defaultSettleDelay":0}'>
</head>
<body style="padding:20px;font-family: sans-serif">
<h1 style="margin-top: 40px">htmx.js test suite</h1>
<p id="version-number">Version:&nbsp;</p>
<h2>Scratch Page</h2>
<ul>
<li>
<a href="scratch/scratch.html">Scratch Page</a>
</li>
</ul>
<h2>Manual Tests</h2>
<a href="manual/">Here</a>
<h2>Mocha Test Suite</h2>
<a href="index.html">[ALL]</a>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/chai-dom/chai-dom.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/mock-socket/dist/mock-socket.js"></script>
<script src="../src/htmx.js"></script>
<script>
// Do not log all the events in headless mode (the log output is enormous)
if (navigator.webdriver) {
htmx.logAll = function () { }
}
// Add the version number to the top
document.getElementById('version-number').innerText += htmx.version
</script>
<script class="mocha-init">
mocha.setup({
ui: "bdd",
rootHooks: {
beforeEach(done) {
console.log(`${this?.currentTest?.parent?.title} - ${this?.currentTest?.title}`)
done()
},
},
})
mocha.checkLeaks();
window.should = window.chai.should()
</script>
<script src="util/util.js"></script>
<!-- core tests -->
<script src="core/internals.js"></script>
<script src="core/api.js"></script>
<script src="core/ajax.js"></script>
<script src="core/config.js"></script>
<script src="core/verbs.js"></script>
<script src="core/parameters.js"></script>
<script src="core/headers.js"></script>
<script src="core/regressions.js"></script>
<script src="core/security.js"></script>
<script src="core/shadowdom.js"></script>
<script src="core/perf.js"></script>
<script src="core/validation.js"></script>
<script src="core/tokenizer.js"></script>
<script src="core/extensions.js"></script>
<script src="core/extension-swap.js"></script>
<!-- attribute tests -->
<script src="attributes/hx-boost.js"></script>
<script src="attributes/hx-confirm.js"></script>
<script src="attributes/hx-delete.js"></script>
<script src="attributes/hx-ext.js"></script>
<script src="attributes/hx-get.js"></script>
<script src="attributes/hx-headers.js"></script>
<script src="attributes/hx-history.js"></script>
<script src="attributes/hx-history-elt.js"></script>
<script src="attributes/hx-include.js"></script>
<script src="attributes/hx-indicator.js"></script>
<script src="attributes/hx-disabled-elt.js"></script>
<script src="attributes/hx-inherit.js"></script>
<script src="attributes/hx-disinherit.js"></script>
<script src="attributes/hx-on-wildcard.js"></script>
<script src="attributes/hx-params.js"></script>
<script src="attributes/hx-patch.js"></script>
<script src="attributes/hx-post.js"></script>
<script src="attributes/hx-preserve.js"></script>
<script src="attributes/hx-prompt.js"></script>
<script src="attributes/hx-push-url.js"></script>
<script src="attributes/hx-put.js"></script>
<script src="attributes/hx-replace-url.js"></script>
<script src="attributes/hx-request.js"></script>
<script src="attributes/hx-select.js"></script>
<script src="attributes/hx-select-oob.js"></script>
<script src="attributes/hx-swap-oob.js"></script>
<script src="attributes/hx-swap.js"></script>
<script src="attributes/hx-sync.js"></script>
<script src="attributes/hx-target.js"></script>
<script src="attributes/hx-trigger.js"></script>
<script src="attributes/hx-vals.js"></script>
<script src="attributes/hx-vars.js"></script>
<!-- this hyperscript integration should be removed once its removed from the tests -->
<script src="lib/_hyperscript.js"></script>
<!-- events last so they don't screw up other tests -->
<script src="core/events.js"></script>
<div id="mocha"></div>
<script class="mocha-exec">
document.addEventListener("DOMContentLoaded", function () {
mocha.run();
})
</script>
<div hx-trigger="restored" hidden>just for htmx:restored event testing</div>
<em>Work Area</em>
<hr/>
<div id="work-area" hx-history-elt>
</div>
</body>
</html>