message: Work for - fixed unit tests (new title) and added test for "load after an error"
diff: @@ -405,3 +405,60 @@ QUnit.test("QuestionFile canPreviewImage", function(assert) {
  "other type"
  );
  });
  +
  +QUnit.test(
  + "QuestionFile process errors during files uploading - https://surveyjs.answerdesk.io/ticket/details/T1075",
  + function(assert) {
  + var json = {
  + questions: [
  + {
  + type: "file",
  + name: "image1",
  + storeDataAsText: false,
  + showPreview: true
  + }
  + ]
  + };
  +
  + var survey = new SurveyModel(json);
  + var q1: QuestionFileModel = <any>survey.getQuestionByName("image1");
  +
  + var isSuccess = true;
  + survey.onUploadFiles.add((survey, options) => {
  + if (isSuccess) {
  + options.callback(
  + "success",
  + options.files.map(file => {
  + return { file: file, content: file.name + "_url" };
  + })
  + );
  + } else {
  + options.callback("error");
  + }
  + });
  +
  + var state = "";
  + q1.onStateChanged.add((_, options) => {
  + state = options.state;
  + });
  +
  + assert.ok(q1.isEmpty());
  + assert.equal(q1.value, undefined);
  + assert.equal(state, "");
  +
  + isSuccess = false;
  + q1.loadFiles([<any>{ name: "f1", type: "t1" }]);
  +
  + assert.ok(q1.isEmpty());
  + assert.equal(q1.value, undefined);
  + assert.equal(state, "error");
  +
  + isSuccess = true;
  + q1.loadFiles([<any>{ name: "f2", type: "t2" }]);
  +
  + assert.notOk(q1.isEmpty());
  + assert.equal(q1.value.length, 1);
  + assert.equal(q1.value[0].content, "f2_url");
  + assert.equal(state, "loaded");
  + }
  +);
  