File: test.html

package info (click to toggle)
htmx 4.0.0-alpha6-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 117,328 kB
  • sloc: javascript: 49,403; sh: 29; makefile: 7
file content (199 lines) | stat: -rw-r--r-- 7,554 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="htmx-config" content='{"logAll":true}'>
    <title>htmx 4.0 Tests</title>

    <!-- Mocha CSS -->
    <link rel="stylesheet" href="https://unpkg.com/mocha@11.7.4/mocha.css">

    <style>
        .playground-wrapper {
            max-width: 900px;
            margin: 3rem auto;
            padding: 1.5rem;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .playground-wrapper h3 {
            margin: 0 0 1.5rem 0;
            padding-bottom: 0.75rem;
            border-bottom: 3px solid #4CAF50;
            font-size: 1.5rem;
            font-weight: 600;
        }

        #test-playground {
            padding: 1.5rem;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            min-height: 100px;
        }

        .header {
            padding: 20px;
            font-family: monospace;
            font-weight: bold;
        }

        .run-all-btn {
            display: inline-block;
            margin: 0 20px 20px 20px;
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            text-decoration: none;
            font-family: sans-serif;
            font-weight: 600;
            font-size: 14px;
            transition: background-color 0.2s;
        }

        .run-all-btn:hover {
            background-color: #45a049;
        }

        .run-all-btn:active {
            background-color: #3d8b40;
        }
    </style>

    <!-- Test infrastructure -->
    <script src="https://unpkg.com/chai@4.5.0/chai.js"></script>
    <script src="https://unpkg.com/mocha@11.7.4/mocha.js"></script>

    <script src="lib/fetch-mock.js"></script>

    <!-- htmx after mocks are set up -->
    <script src="../src/htmx.js"></script>

    <script>
        // Initialize Mocha
        mocha.setup({
            ui: 'bdd',
            fullTrace: true
        });
        window.assert = chai.assert;
        window.should = chai.should();
    </script>

    <!-- Test helpers -->
    <script src="./lib/helpers.js"></script>

    <!-- ============================================ -->
    <!-- Unit Tests -->
    <!-- ============================================ -->
    <script src="./tests/unit/__attributeValue.js"></script>
    <script src="./tests/unit/__collectFormData.js"></script>
    <script src="./tests/unit/__disableEnableElements.js"></script>
    <script src="./tests/unit/__extractFilter.js"></script>
    <script src="./tests/unit/__extractHxHeaders.js"></script>
    <script src="./tests/unit/__findAllExt.js"></script>
    <script src="./tests/unit/__getRequestQueue.js"></script>
    <script src="./tests/unit/__handleHistoryUpdate.js"></script>
    <script src="./tests/unit/__handleHxHeadersAndMaybeReturnEarly.js"></script>
    <script src="./tests/unit/__handleHxVals.js"></script>
    <script src="./tests/unit/__handleStatusCodes.js"></script>
    <script src="./tests/unit/__handleTriggerEvent.js"></script>
    <script src="./tests/unit/__handleTriggerHeader.js"></script>
    <script src="./tests/unit/__initializeTriggers.js"></script>
    <script src="./tests/unit/__issueRequest.js"></script>
    <script src="./tests/unit/__makeFragment.js"></script>
    <script src="./tests/unit/__normalizeSwapStyle.js"></script>
    <script src="./tests/unit/__parseConfig.js"></script>
    <script src="./tests/unit/__parseSwapSpec.js"></script>
    <script src="./tests/unit/__parseTriggerSpecs.js"></script>
    <script src="./tests/unit/__queryEltAndDescendants.js"></script>
    <script src="./tests/unit/__resolveTarget.js"></script>
    <script src="./tests/unit/__shouldBoost.js"></script>
    <script src="./tests/unit/__shouldCancel.js"></script>
    <script src="./tests/unit/__showHideIndicators.js"></script>
    <script src="./tests/unit/__trigger.js"></script>
    <script src="./tests/unit/_htmx.etag.js"></script>
    <script src="./tests/unit/ajax.js"></script>
    <script src="./tests/unit/bootstrap.js"></script>
    <script src="./tests/unit/forEvent.js"></script>
    <script src="./tests/unit/headers.js"></script>
    <script src="./tests/unit/htmx.config.implicitInheritance.js"></script>
    <script src="./tests/unit/htmx.config.metaCharacter.js"></script>
    <script src="./tests/unit/htmx.config.prefix.js"></script>
    <script src="./tests/unit/morph.js"></script>
    <script src="./tests/unit/on.js"></script>
    <script src="./tests/unit/parseInterval.js"></script>
    <script src="./tests/unit/process.js"></script>
    <script src="./tests/unit/swap.js"></script>
    <script src="./tests/unit/timeout.js"></script>
    <script src="./tests/unit/trigger.js"></script>

    <!-- ============================================ -->
    <!-- Attribute Tests -->
    <!-- ============================================ -->
    <script src="./tests/attributes/hx-boost.js"></script>
    <script src="./tests/attributes/hx-config.js"></script>
    <script src="./tests/attributes/hx-confirm.js"></script>
    <script src="./tests/attributes/hx-delete.js"></script>
    <script src="./tests/attributes/hx-disable.js"></script>
    <script src="./tests/attributes/hx-get.js"></script>
    <script src="./tests/attributes/hx-headers.js"></script>
    <script src="./tests/attributes/hx-include.js"></script>
    <script src="./tests/attributes/hx-indicator.js"></script>
    <script src="./tests/attributes/hx-on.js"></script>
    <script src="./tests/attributes/hx-patch.js"></script>
    <script src="./tests/attributes/hx-post.js"></script>
    <script src="./tests/attributes/hx-preserve.js"></script>
    <script src="./tests/attributes/hx-put.js"></script>
    <script src="./tests/attributes/hx-select.js"></script>
    <script src="./tests/attributes/hx-select-oob.js"></script>
    <script src="./tests/attributes/hx-status.js"></script>
    <script src="./tests/attributes/hx-swap.js"></script>
    <script src="./tests/attributes/hx-swap-oob.js"></script>
    <script src="./tests/attributes/hx-trigger.js"></script>
    <script src="./tests/attributes/hx-vals.js"></script>

    <!-- ============================================ -->
    <!-- Extension Tests -->
    <!-- ============================================ -->
    <script src="./tests/ext/hx-optimistic.js"></script>
    <script src="./tests/ext/hx-preload.js"></script>
    <script src="./tests/ext/hx-upsert.js"></script>
    <script src="./tests/ext/hx-ws.js"></script>

    <!-- ============================================ -->
    <!-- End-to-End Tests -->
    <!-- ============================================ -->
    <script src="./tests/end2end/basic-history.js"></script>
    <script src="./tests/end2end/cancel-behavior.js"></script>
    <script src="./tests/end2end/core.js"></script>
    <script src="./tests/end2end/oob.js"></script>
    <script src="./tests/end2end/sse.js"></script>
    <script src="./tests/end2end/strip.js"></script>

    <script>
        // Run tests on load
        window.addEventListener('load', () => {
            mocha.run();
        });
    </script>

</head>
<body>
<div class="header">
    <h1>htmx 4.0 Test Suite</h1>
</div>

<a href="test.html" class="run-all-btn">Run All</a>

<!-- Mocha test output -->
<div id="mocha"></div>

<!-- Test playground (hidden by default) -->
<div class="playground-wrapper">
    <h3>Test Playground</h3>
    <div id="test-playground"></div>
</div>

</body>
</html>