tao-test/app/taoQtiTest/views/js/loader/taoQtiTestRunner.min.js

2 lines
212 KiB
JavaScript
Raw Normal View History

2022-08-29 20:14:13 +02:00
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}(function(){'use strict';var loaderScript=document.getElementById("amd-loader"),configUrl=loaderScript.getAttribute("data-config"),bundle=loaderScript.getAttribute("data-bundle"),loadController=function(){var controllerOptions={},controllerPath=loaderScript.getAttribute("data-controller"),params=loaderScript.getAttribute("data-params");try{controllerOptions=JSON.parse(params)}catch(err){controllerOptions={}}window.require([controllerPath],function(controller){var startController=function(){window.started||(window.started=!0,controller.start(controllerOptions))};document.addEventListener("readystatechange",startController,!1),"complete"===document.readyState&&startController()})};window.require([configUrl],function(){window.loadBundles||(window.loaded={},window.loadBundles=function(bundles){bundles=bundles||[],bundles=bundles.concat(window.bundles),bundles=bundles.filter(function(item,index){return item&&bundles.indexOf(item)===index&&!0!==window.loaded[item]}),require(bundles,function(){bundles.forEach(function(item){window.loaded[item]=!0}),loadController()})}),bundle||window.bundles&&window.bundles.length?window.loadBundles([bundle]):loadController()})})(),define("loader/bootstrap",function(){}),define("css!taoQtiTestCss/new-test-runner",[],function(){}),define("taoQtiTest/controller/runner/runner",["jquery","lodash","i18n","context","module","core/router","core/logger","layout/loading-bar","ui/feedback","util/url","util/locale","taoTests/runner/providerLoader","taoTests/runner/runner","css!taoQtiTestCss/new-test-runner"],function($,_,__,context,module,router,loggerFactory,loadingBar,feedback,urlUtil,locale,providerLoader,runner){'use strict';var requiredOptions=["testDefinition","testCompilation","serviceCallId","bootstrap","options","providers"];return{start:function start(config){var $container=$(".runner"),logger=loggerFactory("controller/runner",{serviceCallId:config.serviceCallId,plugins:config&&config.providers&&Object.keys(config.providers.plugins)}),preventFeedback=!1,errorFeedback=null,exit=function(reason,level){var url=config.options.exitUrl,params={};reason&&(!level&&(level="warning"),params[level]=reason,url=urlUtil.build(url,params)),window.location=url},onError=function(err,displayMessage){onFeedback(err,displayMessage,"error")},onWarning=function(err,displayMessage){onFeedback(err,displayMessage,"warning")},onFeedback=function(err,displayMessage,type){var typeMap={warning:{logger:"warn",feedback:"warning"},error:{logger:"error",feedback:"error"}},loggerByType=logger[typeMap[type].logger],feedbackByType=feedback()[typeMap[type].feedback];return displayMessage=displayMessage||err.message,_.isString(displayMessage)||(displayMessage=JSON.stringify(displayMessage)),loadingBar.stop(),loggerByType({displayMessage:displayMessage},err),"error"===type&&(403===err.code||500===err.code)?(displayMessage="".concat(__("An error occurred during the test, please content your administrator.")," ").concat(displayMessage),exit(displayMessage,"error")):void(!preventFeedback&&(errorFeedback=feedbackByType(displayMessage,{timeout:-1})))},moduleConfig=module.config(),exitReason;return loadingBar.start(),$(".delivery-scope").attr({dir:locale.getLanguageDirection(context.locale)}),requiredOptions.every(function(option){return"undefined"!=typeof config[option]})?void(moduleConfig&&_.isArray(moduleConfig.extraRoutes)&&moduleConfig.extraRoutes.length&&router.dispatch(moduleConfig.extraRoutes),config.provider=Object.assign(config.provider||{},{runner:"qti"}),providerLoader(config.providers,context.bundle).then(function(results){var testRunnerConfig=_.omit(config,["providers"]);if(testRunnerConfig.renderTo=$container,results.proxy&&"function"==typeof results.proxy.getAvailableProviders){var loadedProxies=results.proxy.getAvailableProviders();tes
//# sourceMappingURL=taoQtiTestRunner.min.js.map