Browse Source

updated tests to check complete is called after aborted

pull/178/head
John MacAslan 10 years ago
parent
commit
77c3e6162f
  1. 1
      papaparse.js
  2. 16
      tests/test-cases.js

1
papaparse.js

@ -752,6 +752,7 @@
{ {
_aborted = true; _aborted = true;
_parser.abort(); _parser.abort();
_results.meta.aborted = true;
if (isFunction(_config.complete)) if (isFunction(_config.complete))
_config.complete(_results); _config.complete(_results);
_input = ""; _input = "";

16
tests/test-cases.js

@ -1233,6 +1233,22 @@ var CUSTOM_TESTS = [
}); });
} }
}, },
{
description: "Complete is called after aborting",
expected: true,
run: function(callback) {
var updates = [];
Papa.parse('A,b,c\nd,E,f\nG,h,i', {
step: function(response, handle) {
handle.abort();
},
chunkSize: 6,
complete: function (response) {
callback(response.meta.aborted);
}
});
}
},
{ {
description: "Step functions can pause parsing", description: "Step functions can pause parsing",
expected: [['A', 'b', 'c']], expected: [['A', 'b', 'c']],

Loading…
Cancel
Save