diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2009-12-17 10:02:58 +0800 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-12-18 04:05:45 +0800 |
commit | b31b9bd756a1489c3b1b856ed8b624c55da9e02f (patch) | |
tree | 41b25190990d51eecdd8196662f6535586fadd73 /test | |
parent | 6bc222e7a19d620a79a0b2af46c98664218a81a3 (diff) | |
download | jquery-b31b9bd756a1489c3b1b856ed8b624c55da9e02f.tar.gz jquery-b31b9bd756a1489c3b1b856ed8b624c55da9e02f.zip |
Add new html5 input types to list of serializable types. Older browers handle these as type="text" so they should be consistently serialized on both old and new browsers. Fixes #5667.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/ajax.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 194fbd5f1..39d34093b 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -223,12 +223,18 @@ test("jQuery.ajax - dataType html", function() { test("serialize()", function() { expect(5); + // Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers + jQuery("#search").after( + '<input type="email" id="html5email" name="email" value="dave@jquery.com" />'+ + '<input type="number" id="html5number" name="number" value="43" />' + ); + equals( jQuery('#form').serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2", + "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2", 'Check form serialization as query string'); equals( jQuery('#form :input').serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2", + "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2", 'Check input serialization as query string'); equals( jQuery('#testForm').serialize(), @@ -240,14 +246,15 @@ test("serialize()", function() { 'Check input serialization as query string'); equals( jQuery('#form, #testForm').serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", + "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", 'Multiple form serialization as query string'); /* Temporarily disabled. Opera 10 has problems with form serialization. equals( jQuery('#form, #testForm :input').serialize(), - "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", + "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", 'Mixed form/input serialization as query string'); */ + jQuery("#html5email, #html5number").remove(); }); test("jQuery.param()", function() { |