Skip to content

Commit 858ece5

Browse files
committed
add test cases for #45
1 parent efaebf6 commit 858ece5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: test/integration/encode-test.js

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ describe("encode", function() {
1717
assert.deepEqual($form.serializeObject(), {a: {b: {c: true}}});
1818
});
1919

20+
it("checkbox inputs as array don't break", function() {
21+
var $form = $('<form><input type="checkbox" name="a[]" value="c" checked></form>');
22+
assert.deepEqual($form.serializeObject(), {a: ["c"] });
23+
});
24+
25+
it("checkbox inputs as array with keys don't break", function() {
26+
var $form = $('<form><input type="checkbox" name="a[][b][]" value="c" checked></form>');
27+
assert.deepEqual($form.serializeObject(), {a: [ { b: ["c"] } ]});
28+
});
29+
2030
it("checkbox inputs as booleans if value is 'on'", function() {
2131
var $form = $('<form><input type="checkbox" name="a" value="on" checked></form>');
2232
assert.deepEqual($form.serializeObject(), {a: true});

0 commit comments

Comments
 (0)