summaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEliasPrescott <85904049+EliasPrescott@users.noreply.github.com>2023-10-26 12:53:58 -0500
committerGitHub <noreply@github.com>2023-10-26 11:53:58 -0600
commit0718daa3ac62dfba0c20e357a66fbf24d2169392 (patch)
tree0a36f8cb161ec92af1b45549e7fd4f861c579302 /test
parent7274454360aa5ff5f9a5ed1657450b93e9529b89 (diff)
downloadhtmx-0718daa3ac62dfba0c20e357a66fbf24d2169392.tar.gz
htmx-0718daa3ac62dfba0c20e357a66fbf24d2169392.zip
Fix: form submission of email inputs with `multiple` attribute (#1917)
fixing multiple email input values
Diffstat (limited to 'test')
-rw-r--r--test/core/ajax.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/core/ajax.js b/test/core/ajax.js
index 4dec14ec..0ca9e075 100644
--- a/test/core/ajax.js
+++ b/test/core/ajax.js
@@ -481,6 +481,33 @@ describe("Core htmx AJAX Tests", function(){
values.should.deep.equal({multiSelect:["m1", "m3", "m7", "m8"]});
});
+ it('properly handles multiple email input', function()
+ {
+ var values;
+ this.server.respondWith("Post", "/test", function (xhr) {
+ values = getParameters(xhr);
+ xhr.respond(204, {}, "");
+ });
+
+ var form = make('<form hx-post="/test" hx-trigger="click">' +
+ '<input id="multiEmail" name="multiEmail" multiple>'+
+ '</form>');
+
+ form.click();
+ this.server.respond();
+ values.should.deep.equal({multiEmail: ''});
+
+ byId("multiEmail").value = 'foo@example.com';
+ form.click();
+ this.server.respond();
+ values.should.deep.equal({multiEmail:"foo@example.com"});
+
+ byId("multiEmail").value = 'foo@example.com,bar@example.com';
+ form.click();
+ this.server.respond();
+ values.should.deep.equal({multiEmail:"foo@example.com,bar@example.com"});
+ });
+
it('properly handles checkbox inputs', function()
{
var values;