Skip to content

Commit

Permalink
Add postJson test that fails on Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Jun 11, 2014
1 parent 9143516 commit 948f81b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/jsonPostingBehaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,17 @@ describe('JSON posting', function() {
expect(ko.utils.getFormFields(submittedForm, '__RequestVe').length).toEqual(0);
expect(ko.utils.getFormFields(submittedForm, 'authenticity_token')[0].value).toEqual('wantedval2');
});

it('Should not truncate large values', function() {
// Represents https://github.com/knockout/knockout/issues/1252
var longString = new Array(1000000).join('a'),
longStringJson = JSON.stringify(longString),
submittedForm;
ko.utils.postJson("http://example.com", { longString: longString }, {
submitter: function(x) { submittedForm = x; }
});

expect(submittedForm.longString.value.length).toEqual(longStringJson.length);
expect(submittedForm.longString.value).toEqual(longStringJson);
});
});

0 comments on commit 948f81b

Please sign in to comment.