bender.loadExternalPlugin("exportpdf","/apps/plugin/"),CKEDITOR.plugins.load("exportpdf",function(){function e(e,s){var t=e._.notificationArea.notifications[0];assert.areSame(s.message,t.message,"Message should be the same."),assert.areSame(s.type,t.type,"Type should be the same."),assert.areSame(s.progress,t.progress,"Progress should be the same.")}bender.editors={successEditor:{config:exportPdfUtils.getDefaultConfig("unit")},errorEditor:{config:exportPdfUtils.getDefaultConfig("unit")}},bender.test({setUp:function(){bender.tools.ignoreUnsupportedEnvironment("exportpdf"),sinon.stub(CKEDITOR.plugins.exportpdf,"downloadFile")},tearDown:function(){CKEDITOR.plugins.exportpdf.downloadFile.restore()},"test notifications and progress steps are correct in happy path":function(){var s=this.editors.successEditor;this.editorBots.successEditor.setHtmlWithSelection('<p id="test">Hello, World!</p>^'),s.once("exportPdf",function(){e(s,{message:"Processing PDF document...",type:"progress",progress:0})}),s.once("exportPdf",function(){e(s,{message:"Processing PDF document...",type:"progress",progress:.2})},null,null,16),exportPdfUtils.useXHR(s,function(t){t.addEventListener("progress",function(){e(s,{message:"Processing PDF document...",type:"progress",progress:.8})}),t.addEventListener("loadend",function(){e(s,{message:"Document is ready!",type:"success",progress:1})}),t.respond(200,{},"")})},"test notifications and progress steps are correct in sad path":function(){var s=this.editors.errorEditor;this.editorBots.errorEditor.setHtmlWithSelection('<p id="test">Hello, World!</p>^'),exportPdfUtils.useXHR(s,function(t){var o=sinon.stub(console,"error",function(e){assert.areSame("Validation failed.",e.message,"Message from endpoint is incorrect."),o.restore()});t.addEventListener("loadend",function(){e(s,{message:"Error occurred.",type:"warning"})}),t.respond(400,{},'{ "message": "Validation failed." }')})}})});