diff --git a/player/app-data/fixture-content-list.json b/player/app-data/fixture-content-list.json index 2ca5687f2..6e17b9ddd 100644 --- a/player/app-data/fixture-content-list.json +++ b/player/app-data/fixture-content-list.json @@ -12,6 +12,126 @@ "responseCode": "OK", "result": { "content": [ + { + "identifier": "org.ekstep.cbse_mcq", + "mimeType": "application/vnd.ekstep.ecml-archive", + "contentData": { + "questionnaire": null, + "appIcon": "stories/pratham-camal/logo.png", + "subject": "literacy_v2", + "description": "org.ekstep.cbse_mcq", + "name": "CBSE MCQ", + "downloadUrl": "", + "checksum": null, + "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", + "concepts": [{ + "identifier": "LO1", + "name": "Receptive Vocabulary", + "objectType": "Concept" + }], + "identifier": "org.ekstep.cbse_mcq", + "grayScaleAppIcon": null, + "pkgVersion": 1 + }, + "isAvailable": true, + "path": "fixture-stories/CBSE_MCQ" + }, + { + "identifier": "org.ekstep.cbse_sa", + "mimeType": "application/vnd.ekstep.ecml-archive", + "contentData": { + "questionnaire": null, + "appIcon": "stories/pratham-camal/logo.png", + "subject": "literacy_v2", + "description": "org.ekstep.cbse_sa", + "name": "CBSE SA", + "downloadUrl": "", + "checksum": null, + "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", + "concepts": [{ + "identifier": "LO1", + "name": "Receptive Vocabulary", + "objectType": "Concept" + }], + "identifier": "org.ekstep.cbse_sa", + "grayScaleAppIcon": null, + "pkgVersion": 1 + }, + "isAvailable": true, + "path": "fixture-stories/CBSE_SA" + }, + { + "identifier": "org.ekstep.cbse_la", + "mimeType": "application/vnd.ekstep.ecml-archive", + "contentData": { + "questionnaire": null, + "appIcon": "stories/pratham-camal/logo.png", + "subject": "literacy_v2", + "description": "org.ekstep.cbse_la", + "name": "CBSE LA", + "downloadUrl": "", + "checksum": null, + "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", + "concepts": [{ + "identifier": "LO1", + "name": "Receptive Vocabulary", + "objectType": "Concept" + }], + "identifier": "org.ekstep.cbse_la", + "grayScaleAppIcon": null, + "pkgVersion": 1 + }, + "isAvailable": true, + "path": "fixture-stories/CBSE_LA" + }, + { + "identifier": "org.ekstep.cbse_vsa", + "mimeType": "application/vnd.ekstep.ecml-archive", + "contentData": { + "questionnaire": null, + "appIcon": "stories/pratham-camal/logo.png", + "subject": "literacy_v2", + "description": "org.ekstep.cbse_vsa", + "name": "CBSE VSA", + "downloadUrl": "", + "checksum": null, + "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", + "concepts": [{ + "identifier": "LO1", + "name": "Receptive Vocabulary", + "objectType": "Concept" + }], + "identifier": "org.ekstep.cbse_vsa", + "grayScaleAppIcon": null, + "pkgVersion": 1 + }, + "isAvailable": true, + "path": "fixture-stories/CBSE_VSA" + }, + { + "identifier": "org.ekstep.selfassess", + "mimeType": "application/vnd.ekstep.ecml-archive", + "contentData": { + "questionnaire": null, + "appIcon": "stories/pratham-camal/logo.png", + "subject": "literacy_v2", + "description": "Selfassess", + "name": "QS-SelfAssess", + "downloadUrl": "", + "checksum": null, + "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", + "concepts": [{ + "identifier": "LO1", + "name": "Receptive Vocabulary", + "objectType": "Concept" + }], + "identifier": "org.ekstep.selfassess", + "grayScaleAppIcon": null, + "pkgVersion": 1 + }, + "isAvailable": true, + "path": "fixture-stories/question-set" + }, {"identifier": "do_312719162116210688118940", "mimeType": "video/mp4", "contentData": diff --git a/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/audio-icon.png b/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/audio-icon.png new file mode 100644 index 000000000..f6ae0565e Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/audio-icon.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/down_arrow.png b/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/down_arrow.png new file mode 100644 index 000000000..e6d74145b Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/assets/content-plugins/org.ekstep.questionunit-1.0/renderer/assets/down_arrow.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/index.ecml b/player/public/fixture-stories/CBSE_MCQ/index.ecml new file mode 100644 index 000000000..c3ceaf5f0 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/index.ecml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

MCQ First Question

   लेखक स्वयं

.उसका छोटा भाई

उसका बड़ा भाई

उसका मित्र

","media":[],"responseDeclaration":{"responseValue":{"cardinality":"single","type":"integer","correct_response":{"value":"0"}}},"options":[{"answer":true,"value":{"type":"text","body":"

   लेखक स्वयं

","resvalue":0,"resindex":0}},{"answer":false,"value":{"type":"text","body":"

.उसका छोटा भाई

","resvalue":1,"resindex":1}},{"answer":false,"value":{"type":"text","body":"

उसका बड़ा भाई

","resvalue":2,"resindex":2}},{"answer":false,"value":{"type":"text","body":"

उसका मित्र

","resvalue":3,"resindex":3}}],"solution":[{"value":"

Image as solution

","type":"html"}],"questionCount":0}]]>
+ +
+ +

MCQ Second Question

जंगल में

कुएँ में

बस में

रास्ते में

","media":[],"responseDeclaration":{"responseValue":{"cardinality":"single","type":"integer","correct_response":{"value":"1"}}},"options":[{"answer":false,"value":{"type":"text","body":"

जंगल में

","resvalue":0,"resindex":0}},{"answer":true,"value":{"type":"text","body":"

कुएँ में

","resvalue":1,"resindex":1}},{"answer":false,"value":{"type":"text","body":"

बस में

","resvalue":2,"resindex":2}},{"answer":false,"value":{"type":"text","body":"

रास्ते में

","resvalue":3,"resindex":3}}],"solution":[{"value":"

Text and Image as solution

","type":"html"}],"questionCount":0}]]>
+ +
+ +

MCQ Third Question

बचपन की घटना का

किशोरावस्था की घटना का

युवा अवस्था का

वृद्धावस्था का

","media":[],"responseDeclaration":{"responseValue":{"cardinality":"single","type":"integer","correct_response":{"value":"0"}}},"options":[{"answer":true,"value":{"type":"text","body":"

बचपन की घटना का

","resvalue":0,"resindex":0}},{"answer":false,"value":{"type":"text","body":"

किशोरावस्था की घटना का

","resvalue":1,"resindex":1}},{"answer":false,"value":{"type":"text","body":"

युवा अवस्था का

","resvalue":2,"resindex":2}},{"answer":false,"value":{"type":"text","body":"

वृद्धावस्था का

","resvalue":3,"resindex":3}}],"solution":[{"value":"

Text as solution

","type":"html"}],"questionCount":0}]]>
+ +
+ +

MCQ Fourth Question

जयशंकर प्रसाद

मैथिलीशरण गुप्त

महादेवी वर्मा

श्रीराम शर्मा

","media":[{"identifier":"do1234567890","src":"path","type":"video"}],"responseDeclaration":{"responseValue":{"cardinality":"single","type":"integer","correct_response":{"value":"3"}}},"options":[{"answer":false,"value":{"type":"text","body":"

जयशंकर प्रसाद

","resvalue":0,"resindex":0}},{"answer":false,"value":{"type":"text","body":"

मैथिलीशरण गुप्त

","resvalue":1,"resindex":1}},{"answer":false,"value":{"type":"text","body":"

महादेवी वर्मा

","resvalue":2,"resindex":2}},{"answer":true,"value":{"type":"text","body":"

श्रीराम शर्मा

","resvalue":3,"resindex":3}}],"solution":[{"value":"media ID","type":"video"}],"questionCount":0}]]>
+ +
+ +

MCQ Fourth Question without solution

कुएँ में

.नदी में

किसी के घर में

तालाब में

","media":[],"responseDeclaration":{"responseValue":{"cardinality":"single","type":"integer","correct_response":{"value":"0"}}},"options":[{"answer":true,"value":{"type":"text","body":"

कुएँ में

","resvalue":0,"resindex":0}},{"answer":false,"value":{"type":"text","body":"

.नदी में

","resvalue":1,"resindex":1}},{"answer":false,"value":{"type":"text","body":"

किसी के घर में

","resvalue":2,"resindex":2}},{"answer":false,"value":{"type":"text","body":"

तालाब में

","resvalue":3,"resindex":3}}],"questionCount":0}]]>
+ +
+
+
+ + + + + + + +
\ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/editor/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/editor/plugin.js new file mode 100644 index 000000000..f80a6054b --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/editor/plugin.js @@ -0,0 +1,14 @@ +/** + * @class org.ekstep.iterator.EditorPlugin + */ +org.ekstep.contenteditor.basePlugin.extend({ + + /** + * @memberOf org.ekstep.iterator.EditorPlugin# + */ + initialize:function(){ + + }, + newInstance: function() {} +}); +//# sourceURL=iteratorEditorPlugin.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/manifest.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/manifest.json new file mode 100644 index 000000000..ab28bf320 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/manifest.json @@ -0,0 +1,20 @@ +{ + "id": "org.ekstep.iterator", + "ver": "1.0", + "author": "Jagadish", + "type": "plugin", + "title": "Iterator", + "description": "It is a base plugin for all collection plugins which needs navigation control", + "editor": { + "main": "editor/plugin.js", + "dependencies": [], + "menu": [] + }, + "renderer": { + "main": "renderer/plugin.js" + }, + "icon": "assets/icon.png", + "languages": ["English"], + "categories": [""], + "keywords": [""] +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/renderer/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/renderer/plugin.js new file mode 100644 index 000000000..e260224e4 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.iterator-1.0/renderer/plugin.js @@ -0,0 +1,35 @@ +/** + * Plugin to event handler + * @extends base Plugin + * @author Jagadish P + */ + + /* istanbul ignore next */ + IteratorPlugin = Plugin.extend({ + _type: 'org.ekstep.iterator', + _isContainer: false, + _render: true, + _itemIndex: -1, + initialize: function() { + var instance = this; + }, + registerNavigation: function(PluginInstance){ + EkstepRendererAPI.dispatchEvent('renderer:navigation:register',PluginInstance); + }, + deregisterNavigation: function(PluginInstance){ + EkstepRendererAPI.dispatchEvent('renderer:navigation:deregister',PluginInstance); + }, + handleNext:function(){ + + }, + handlePrevious:function(){ + + }, + reInstateQuestionsOnReview: function(param) { } + /*, + hasPrevious: function (navType) { + // navType: String --> "prev" or "next" + // Denotes the navigation event that it is triggered for + }*/ +}); +//#sourceURL=iterator.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/editor/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/editor/plugin.js new file mode 100644 index 000000000..a266376de --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/editor/plugin.js @@ -0,0 +1,79 @@ +/** + * @class org.ekstep.navigation.EditorPlugin + */ +org.ekstep.contenteditor.basePlugin.extend({ + + /** + * @memberOf org.ekstep.navigation.EditorPlugin# + */ + initialize:function() { + var instance = this; + ecEditor.addEventListener('content:load:complete', function(event) { + /*console.log('adding nav media'); + var stage = ecEditor.getCurrentStage(); + var nextImage = { + id: "nextImage", + src: org.ekstep.contenteditor.mediaManager.getMediaOriginURL(ecEditor.resolvePluginResource(instance.manifest.id, '1.0', 'renderer/assets/next.png')), + assetId: "nextImage", + type: "image", + preload: true + }; + stage.addMedia(nextImage); + console.log(nextImage); + var prevImage = { + id: "prevImage", + src: org.ekstep.contenteditor.mediaManager.getMediaOriginURL(ecEditor.resolvePluginResource(instance.manifest.id, '1.0', 'renderer/assets/previous.png')), + assetId: "prevImage", + type: "image", + preload: true + }; + stage.addMedia(prevImage); + console.log(prevImage);*/ + ecEditor.instantiatePlugin(instance.manifest.id, {}, undefined); + }); + + /*// For every new stage create navigation plugin instance. + ecEditor.addEventListener('stage:add', function(event) { + ecEditor.instantiatePlugin(instance.manifest.id, {}, ecEditor.getCurrentStage()); + }); + // While content load, event bus is disabled so, unable to catch `stage:add` event (for empty content by default new stage is created). + // Creating the new instance on content loaded. + ecEditor.addEventListener('content:load:complete', function(event) { + var allStages = ecEditor.getAllStages(); + allStages.forEach(function (stage) { + var addedNavigation = false; + var stageChildren = stage.children; + stageChildren.forEach(function (child) { + if(child.manifest.id == instance.manifest.id) { + addedNavigation = true; + } + }); + if(!addedNavigation) { + ecEditor.instantiatePlugin(instance.manifest.id, {}, stage); + } + }); + });*/ + }, + + newInstance: function() { + /*console.log('this', this); + var nextImage = ecEditor.resolvePluginResource(this.manifest.id, '1.0', 'renderer/assets/next.png'); + this.addMedia({ + id: "nextImage", + src: org.ekstep.contenteditor.mediaManager.getMediaOriginURL(nextImage), + assetId: "nextImage", + type: "image", + preload: true + }); + var preImage = ecEditor.resolvePluginResource(this.manifest.id, '1.0', 'renderer/assets/previous.png'); + this.addMedia({ + id: "prevImage", + src: org.ekstep.contenteditor.mediaManager.getMediaOriginURL(preImage), + assetId: "preImage", + type: "image", + preload: true + });*/ + } +}); +//# sourceURL=navigationEditorPlugin.js + diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/manifest.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/manifest.json new file mode 100644 index 000000000..7eb721406 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/manifest.json @@ -0,0 +1,31 @@ +{ + "id": "org.ekstep.navigation", + "ver": "1.0", + "author": "Jagadish", + "type": "plugin", + "title": "Navigation", + "description": "", + "editor": { + "main": "editor/plugin.js", + "menu": [] + }, + "renderer": { + "main": "renderer/plugin.js", + "dependencies": [ + { + "type": "js", + "src": "renderer/controller/navigation_ctrl.js", + "scope": "all" + }, + { + "type": "js", + "src": "renderer/templates/navigation.html", + "scope": "all" + } + ] + }, + "icon": "assets/icon.png", + "languages": ["English"], + "categories": [""], + "keywords": [""] +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/next.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/next.png new file mode 100644 index 000000000..dcc16a88b Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/next.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/previous.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/previous.png new file mode 100644 index 000000000..9ec61cb95 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/assets/previous.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js new file mode 100644 index 000000000..1ef015fc5 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js @@ -0,0 +1,219 @@ +'use strict'; + +angular.module('genie-canvas').directive('customNextNavigation', function ($rootScope, $timeout) { + return { + restrict: 'E', + template: '
', + link: function (scope) { + scope.customNextIcon = EkstepRendererAPI.resolvePluginResource("org.ekstep.overlay", "1.0", "renderer/assets/icons/next.png"); + var events = ["overlayNext", "renderer:next:hide", "renderer:next:show"]; + scope.toggleNav = function (event) { + var val; + var globalConfig = EkstepRendererAPI.getGlobalConfig(); + var defaultValue = globalConfig.overlay.showNext ? "on" : "off"; + var hideDefaultNext = function () { + $timeout(function () { + jQuery('next-navigation').hide(); + jQuery("#nav-next").hide(); + }, 50); + }; + switch (event.type) { + /** + * renderer:next:show Event to show next navigation icon. + * @event renderer:next:show + * @listen renderer:next:show + * @memberOf EkstepRendererEvents + */ + case "renderer:next:show": + val = "on"; + hideDefaultNext(); + break; + /** + * renderer:next:hide Event to hide next navigation icon. + * @event renderer:next:hide + * @listen renderer:next:hide + * @memberOf EkstepRendererEvents + */ + case "renderer:next:hide": + val = "off"; + hideDefaultNext(); + break; + case "overlayNext": + val = event.target ? event.target : defaultValue; + hideDefaultNext(); + break; + } + scope.showCustomNext = val; + $rootScope.safeApply(); + }; + _.each(events, function (event) { + EkstepRendererAPI.addEventListener(event, scope.toggleNav, scope) + }); + } + } +}).directive('customPreviousNavigation', function ($rootScope, $timeout) { + return { + restrict: 'E', + template: '
', + link: function (scope) { + var events = ["overlayPrevious", "renderer:previous:hide", "renderer:previous:show", "renderer:previous:disable", "renderer:previous:enable"]; + scope.customePreviousIcon = EkstepRendererAPI.resolvePluginResource("org.ekstep.overlay", "1.0", "renderer/assets/icons/back.png"); + scope.changeValue = function (event) { + var val; + var globalConfig = EkstepRendererAPI.getGlobalConfig(); + var defaultValue = globalConfig.overlay.showPrevious ? "on" : "off"; + var hideDefaultPrevious = function () { + $timeout(function () { + jQuery('previous-navigation').hide(); + jQuery("#nav-previous").hide(); + }, 50); + }; + var disablePrevious = function () { + var val = ""; + var navigateToStage = EkstepRendererAPI.getStageParam('previous'); + var stage = EkstepRendererAPI.getCurrentStage(); + if (stage && _.isUndefined(navigateToStage)) { + val = "disable"; + hideDefaultPrevious(); + if (EkstepRendererAPI.isItemScene() && EkstepRendererAPI.getCurrentController().hasPrevious()) { + val = "enable" + } + } else { + val = "enable" + } + return val; + }; + switch (event.type) { + case "overlayPrevious": + val = event.target ? event.target : defaultValue; + hideDefaultPrevious(); + break; + /** + * renderer:previous:show Event to show previous navigation icon. + * @event renderer:previous:show + * @listen renderer:previous:show + * @memberOf EkstepRendererEvents + */ + case "renderer:previous:show": + hideDefaultPrevious(); + val = "on"; + break; + /** + * renderer:previous:hide Event to hide previous navigation icon. + * @event renderer:previous:hide + * @listen renderer:previous:hide + * @memberOf EkstepRendererEvents + */ + case "renderer:previous:hide": + hideDefaultPrevious(); + val = "off"; + break; + + case "renderer:previous:disable": + val = disablePrevious(); + break; + + case "renderer:previous:enable": + val = "on"; + break; + } + if (val == "on" && event.type !== "renderer:previous:enable") { + val = disablePrevious(); + } + + scope.showCustomPrevious = val; + $rootScope.safeApply(); + } + _.each(events, function (event) { + EkstepRendererAPI.addEventListener(event, scope.changeValue, scope) + }) + } + } +}).controllerProvider.register("CustomNavigationCtrl", function ($scope, $rootScope, $compile, $stateParams, $timeout) { + var globalConfig = EkstepRendererAPI.getGlobalConfig(); + $scope.customNavigationVisible = false; + $rootScope.isItemScene = false; + $rootScope.stageId = undefined; + $scope.state_off = "off"; + $scope.state_on = "on"; + $scope.state_disable = "disable"; + $scope.overlayVisible = false; + $scope.pluginInstance = undefined; + $scope.init = function () { + EkstepRendererAPI.addEventListener("renderer:content:start", $scope.showCustomNavigation); + EkstepRendererAPI.addEventListener("renderer:overlay:show", $scope.showCustomNavigation); + EkstepRendererAPI.addEventListener("renderer:overlay:hide", $scope.hideCustomNavigation); + EkstepRendererAPI.addEventListener("renderer:content:reset", $scope.resetNavigation); + + $scope.pluginInstance = EkstepRendererAPI.getPluginObjs("org.ekstep.navigation"); + + EkstepRendererAPI.addEventListener("sceneEnter", function (data) { + $timeout(function () { + $scope.showCustomNavigation(); + }, 0); + }); + + $timeout(function () { + $scope.showCustomNavigation(); + }, 0); + + if ($scope.pluginInstance) { + if (globalConfig.overlay.showOverlay) { + $scope.customNavigationVisible = $scope.pluginInstance.customNavigationVisible; + $scope.safeApply(); + } + } + }; + + $scope.showCustomNavigation = function () { + if (!globalConfig.overlay.showOverlay) return; + $scope.customNavigationVisible = true; + $scope.hideDefaultNavigation(); + $scope.safeApply(); + }; + + $scope.resetNavigation = function(){ + $scope.pluginInstance._customNavigationPlugins = []; + } + + $scope.hideDefaultNavigation = function () { + $timeout(function () { + jQuery('previous-navigation').hide(); + jQuery('next-navigation').hide(); + jQuery("#nav-next").hide(); + jQuery("#nav-previous").hide(); + EkstepRendererAPI.dispatchEvent("renderer:previous:disable"); + }, 50); + }; + + $scope.hideCustomNavigation = function () { + $scope.customNavigationVisible = false; + $scope.safeApply(); + }; + + $scope.navigate = function (navType) { + var currentStageId = EkstepRendererAPI.getCurrentStageId(); + if (navType === "next") { + /** + * actionNavigateNext event used to navigate to next stage from the current stage of the content. + * @event actionNavigateNext + * @fires actionNavigateNext + * @memberof EkstepRendererEvents + */ + EventBus.dispatch("renderer:navigation:next", currentStageId); + + } else if (navType === "previous") { + /** + * actionNavigatePrevious event used to navigate to previous stage from the current stage of the content. + * @event actionNavigatePrevious + * @fires actionNavigatePrevious + * @memberof EkstepRendererEvents + */ + EventBus.dispatch("renderer:navigation:prev"); + } + }; + + $scope.init(); +}); + +//# sourceURL=CustomNavigationCtrl.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js new file mode 100644 index 000000000..081211bca --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js @@ -0,0 +1,83 @@ +/** + * Plugin to event handler + * @extends base Plugin + * @author Jagadish P + */ + + /* istanbul ignore next */ + Plugin.extend({ + _type: 'org.ekstep.navigation', + _render: true, + customNavigationVisible: false, + _config:{}, + _templatePath: undefined, + _customNavigationPlugins:[], + initialize: function() { + var instance = this; + this._templatePath = org.ekstep.pluginframework.pluginManager.resolvePluginResource(this._manifest.id, this._manifest.ver, "renderer/templates/navigation.html"); + this.controllerPath = org.ekstep.pluginframework.pluginManager.resolvePluginResource(this._manifest.id, this._manifest.ver, "renderer/controller/navigation_ctrl.js"); + org.ekstep.service.controller.loadNgModules(this._templatePath, this.controllerPath); + + EkstepRendererAPI.addEventListener("renderer:overlay:show", instance.showOrHideOverlay, instance); + EkstepRendererAPI.addEventListener("renderer:content:start", instance.showOrHideOverlay, instance); + //Register plugin for custom navigation + EkstepRendererAPI.addEventListener("renderer:navigation:register",function(event, data){ + instance._customNavigationPlugins.push(event.target); + }); + + //Register plugin for custom navigation + EkstepRendererAPI.addEventListener("renderer:navigation:deregister",function(event){ + var index = _.findIndex(instance._customNavigationPlugins, function(pluginInstance){ return pluginInstance.id == event.target.id}); + if (index > -1) { + instance._customNavigationPlugins.splice(index, 1); + } + }); + + //If register call plugin next method + EkstepRendererAPI.addEventListener("renderer:navigation:next",function(event){ + var registered = _.isEmpty(instance._customNavigationPlugins); + if(!registered){ + // Get the first plugin instance and pass control to it. + var pluginInstance = instance._customNavigationPlugins[0]; + pluginInstance.handleNext(); + + if(pluginInstance._itemIndex > 0){ + EventBus.dispatch("renderer:previous:enable"); + } + } else { + EventBus.dispatch("actionNavigateNext", "next"); + EventBus.dispatch("nextClick"); + } + }); + + //If register call plugin previous method + EkstepRendererAPI.addEventListener("renderer:navigation:prev",function(event){ + var registered = _.isEmpty(instance._customNavigationPlugins); + var pluginInstance = instance._customNavigationPlugins[0]; + if(!registered){ + pluginInstance.handlePrevious(); + if(pluginInstance._itemIndex <= 0){ + EventBus.dispatch("renderer:previous:disable"); + } + + }else { + EventBus.dispatch("actionNavigatePrevious", "previous"); + EventBus.dispatch("previousClick"); + } + setTimeout(function(){ + var pluginInstance = instance._customNavigationPlugins[0]; + if(pluginInstance._itemIndex > 0){ + EventBus.dispatch("renderer:previous:enable"); + } + }, 500); + }); + + }, + initPlugin: function (data) { + // Plugin actions are handled in the angularJS controller. + }, + showOrHideOverlay: function(){ + this.customNavigationVisible = true; + } +}); +//# sourceURL=navigation.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html new file mode 100644 index 000000000..981b58bd3 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html @@ -0,0 +1,4 @@ +
+ + +
diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.eslintrc.yaml b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.eslintrc.yaml new file mode 100644 index 000000000..9c96e38a3 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.eslintrc.yaml @@ -0,0 +1,3 @@ +extends: "ekstep-content-plugin" +rules: + indent: ["error", 2, { "SwitchCase": 1 }] \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.gitignore b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.gitignore new file mode 100644 index 000000000..1ca5639d4 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +node_modules +bower_components +coverage +docs +dist +npm-debug.log \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/Jenkinsfile b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/Jenkinsfile new file mode 100644 index 000000000..ad419e8a9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/Jenkinsfile @@ -0,0 +1,5 @@ +@Library('ekstep-content-plugin-jenkins-common') _ + +buildContentPlugin { + +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/README.md b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/README.md new file mode 100644 index 000000000..d9f2840ef --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/README.md @@ -0,0 +1,11 @@ +# org.ekstep.questionset + +Plugin to add question set to content + +### Usage + +How do people use this plugin? + +### Development + +Please refer to [wiki](https://github.com/ekstep/Contributed-Plugins/wiki) for plugin development guidelines \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/assets/icon.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/assets/icon.png new file mode 100644 index 000000000..5d0d0df9d Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/assets/icon.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bin/updateFrameworkDependencies.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bin/updateFrameworkDependencies.js new file mode 100644 index 000000000..b9a9348e9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bin/updateFrameworkDependencies.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node + +var rimraf = require('rimraf'); +var execSync = require('child_process').execSync; + +rimraf.sync('bower_components/ekstep-content-plugin-dev-common'); +rimraf.sync('node_modules/ekstep-content-plugin-dev-common'); +execSync('npm install', { stdio: 'inherit' }); +require('ekstep-content-plugin-dev-common/bin/updateFrameworkDependencies.js'); diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bower.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bower.json new file mode 100644 index 000000000..3accde0d7 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/bower.json @@ -0,0 +1,6 @@ +{ + "name": "org.ekstep.questionset", + "dependencies": { + "ekstep-content-plugin-dev-common": "ekstep/ekstep-content-plugin-dev-common" + } +} diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/ftb_app_icon.jpg b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/ftb_app_icon.jpg new file mode 100644 index 000000000..0c038a287 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/ftb_app_icon.jpg differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mcq_app_icon.jpg b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mcq_app_icon.jpg new file mode 100644 index 000000000..07ac00cf1 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mcq_app_icon.jpg differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mtf_app_icon.jpg b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mtf_app_icon.jpg new file mode 100644 index 000000000..e08f742e7 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/mtf_app_icon.jpg differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/quizimage.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/quizimage.png new file mode 100644 index 000000000..6f7dbfd1b Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/quizimage.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/reorder_app_icon.jpg b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/reorder_app_icon.jpg new file mode 100644 index 000000000..75a039841 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/reorder_app_icon.jpg differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/sequence_app_icon.jpg b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/sequence_app_icon.jpg new file mode 100644 index 000000000..63827ad96 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/assets/sequence_app_icon.jpg differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/help.md b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/help.md new file mode 100644 index 000000000..d5a3d11dc --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/help.md @@ -0,0 +1 @@ +***org.ekstep.questionset*** \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/plugin.js new file mode 100644 index 000000000..0e70c236e --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/plugin.js @@ -0,0 +1,453 @@ +/** + * + * Plugin to create question set and add it to stage. + * @class questionset + * @extends org.ekstep.contenteditor.basePlugin + * @author Manoj Chandrashekar + */ + +// Register namespace +org.ekstep.questionset = {}; +org.ekstep.questionset.EditorPlugin = org.ekstep.contenteditor.basePlugin.extend({ + type: "org.ekstep.questionset", + _plugins : [], + _questions: [], + _questionPlugin: 'org.ekstep.question', + _constants: { + v1PluginId: "org.ekstep.questionset.quiz", + templateId: "horizontalMCQ" + }, + _dependencyPlugin: "org.ekstep.questionbank", + /** + * Register events. + * @memberof questionset + */ + initialize: function () { + var instance = this; + + //Load dependecny plugin + var publishedDate = new Date().getTime(); + ecEditor.loadAndInitPlugin(instance._dependencyPlugin, "1.0", publishedDate); + //Loading question unit plugins(MCQ,FTB and MTF) which all having target id 'org.ekstep.questionset' + //this.loadQSPlugins(); + //Get loaded plugins + ecEditor.addEventListener(this.manifest.id + ":getPlugins", this.getplugins, this); + + ecEditor.addEventListener(instance.manifest.id + ":showPopup", instance.openQuestionBank, instance); + ecEditor.addEventListener(instance.manifest.id + ":addQS", instance.addQS, instance); + var pluginsData = [ + { + "identifier": "org.ekstep.questionunit.mtf", + "appIcon": ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/mtf_app_icon.jpg'), + "semanticVersion": "1.2", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.mcq", + "appIcon": ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/mcq_app_icon.jpg'), + "semanticVersion": "1.3", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.ftb", + "appIcon": ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/ftb_app_icon.jpg'), + "semanticVersion": "1.1", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.reorder", + "appIcon": ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/reorder_app_icon.jpg'), + "semanticVersion": "1.1", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.sequence", + "appIcon": ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/sequence_app_icon.jpg'), + "semanticVersion": "1.1", + "contentType": "Plugin", + "objectType": "Content" + } + ]; + instance.pluginsRespHandler(pluginsData); + }, + newInstance: function () { + var instance = this; + delete this.configManifest; + instance.config.btn_edit = "Edit"; + var _parent = this.parent; + this.parent = undefined; + /*istanbul ignore else*/ + if (!this.attributes.x) { + this.attributes.x = 10; + this.attributes.y = 3; + this.attributes.w = 78; + this.attributes.h = 94; + this.percentToPixel(this.attributes); + } + var props = this.convertToFabric(this.attributes); + delete props.width; + delete props.height; + //add media to stage + instance._questions = instance.data ? instance.data : []; + // Add all question media to media manifest + if (_.isArray(this._questions)) { + this._questions.forEach(function (question) { + if (question.version == 1) { + if (_.has(question, "media")) { + question.media.forEach(function (mediaItem) { + instance.addMedia(mediaItem); + }) + } + if (_.has(question, "mediamanifest")) { + if (_.isArray(question.mediamanifest.media)) { + question.mediamanifest.media.forEach(function (mediaItem) { + instance.addMedia(mediaItem); + }) + } + } + } else { + var quesMedia = JSON.parse(question.body); + quesMedia.data.config.max_score = question.max_score; + question.body = JSON.stringify(quesMedia); + var questionData = quesMedia.data; + if (_.isEmpty(questionData.media) && _.has(quesMedia, "media")) { + questionData.media.forEach(function (mediaItem) { + mediaItem.src = org.ekstep.contenteditor.mediaManager.getMediaOriginURL(mediaItem.src) + instance.addMedia(mediaItem); + }); + } + } + }); + } + // Add stage object + var stageImage = ecEditor.resolvePluginResource(this.manifest.id, this.manifest.ver, 'editor/assets/quizimage.png'); + instance.addMedia({ + id: "QuizImage", + src: stageImage, + assetId: "QuizImage", + type: "image", + preload: true + }); + + fabric.Image.fromURL(stageImage, function (img) { + var count = instance.config.total_items + '/' + instance.data.length; + var quizDetails = instance.getPropsForEditor(instance.config.title, count, instance.config.max_score); + instance.editorObj = new fabric.Group([img, quizDetails]); + //instance.editorObj = img; + instance.parent = _parent; + instance.editorObj.scaleToWidth(props.w); + instance.postInit(); + }, props); + //Getting numberf questions for assessment summary : testing purpose + //instance.getSummary();//Testing + }, + getPropsForEditor: function (qTittle, qCount, maxscore) { + /* Display the all properties(title,count and maxscore) on the editor*/ + qTittle = new fabric.Text(qTittle.toUpperCase(), { + fontSize: 15, + fill: 'black', + textAlign: 'center', + top: 33, + left: 105 + }); + qCount = new fabric.Text(qCount + " Questions,", { + fontSize: 12, + fill: 'black', + top: 50, + left: 105 + }); + maxscore = new fabric.Text(maxscore + " Marks", { + fontSize: 12, + fill: 'black', + top: 50, + left: 190, + }); + var fabricGroup = new fabric.Group([qTittle, qCount, maxscore]); + return fabricGroup; + }, + addQS: function (event, dataObj) { + var questions = []; + if (_.isArray(dataObj.data.data)) { + dataObj.data.data.forEach(function (question) { + questions.push(question); + }); + } + var qdata = {}; + qdata.config = { + __cdata: JSON.stringify(dataObj.data.config) + }; + qdata.data = questions; + + if (!ecEditor._.isUndefined(dataObj.callback)) { + ecEditor.dispatchEvent('delete:invoke'); + } + ecEditor.dispatchEvent(this.manifest.id + ':create', qdata); + }, + createEcmlStructureV1: function (question) { + var instance = this, + questionSets = {}, + controller = { + "questionnaire": {}, + "template": {} + }; + var questionTemplate = Object.assign({}, question); + delete questionTemplate.template; + delete questionTemplate.mediamanifest; + questionTemplate["template"] = question.template[0].id; + questionSets[question.identifier] = [questionTemplate]; + controller.questionnaire["items"] = questionSets; + controller.questionnaire["item_sets"] = [{ + "count": instance.config.total_items, + "id": question.identifier + }]; + controller["questionnaire"] = ecEditor._.assign(controller.questionnaire, instance.config); + controller["template"] = ecEditor._.assign(question.template); + return JSON.stringify(controller); + }, + toECML: function () { + var instance = this; + + // Generate the questionSet ECML by using the basePlugin `toECML` function. + var questionSetECML = this._super(); + questionSetECML[instance._questionPlugin] = []; + + if (_.isArray(instance.data)) { + instance.data.forEach(function (question) { + var questionECML = {}; + if (question.version == 1) { + questionECML = { + id: _.isUndefined(question.identifier) ? UUID() : question.identifier, + type: question.type, + pluginId: instance._constants.v1PluginId, + pluginVer: (question.version === 1) ? '1.0' : question.version.toString(), + templateId: instance._constants.templateId, + data: { + __cdata: instance.createEcmlStructureV1(question) + }, + config: { + __cdata: JSON.stringify({ + "type": "items", + "var": "item" + }) + } + } + ecEditor._.forEach(question.media, function (asset) { + if (!ecEditor._.isEmpty(asset)) + instance.addMedia(asset); + }); + ecEditor.instantiatePlugin(instance._constants.v1PluginId, {}); + + } else { + var questionBody = JSON.parse(question.body); + // Build Question ECML for each question that is added. + questionECML = { + id: _.isUndefined(question.identifier) ? UUID() : question.identifier, + type: question.type, + pluginId: questionBody.data.plugin.id, + pluginVer: questionBody.data.plugin.version, + templateId: questionBody.data.plugin.templateId, + data: { + __cdata: JSON.stringify(questionBody.data.data) + }, + config: { + __cdata: JSON.stringify(questionBody.data.config) + } + }; + + // Instantiate the question unit plugin to add it to + ecEditor.instantiatePlugin(questionBody.data.plugin.id, {}); + // delete questionSetECML.data; + ecEditor._.forEach(questionBody.data.media, function (asset) { + if (!ecEditor._.isEmpty(asset)) + instance.addMedia(asset); + }); + } + questionECML.w = 80; + questionECML.h = 85; + questionECML.x = 9; + questionECML.y = 6; + questionSetECML.w = 80; + questionSetECML.h = 85; + questionSetECML.x = 9; + questionSetECML.y = 6; + questionSetECML[instance._questionPlugin].push(questionECML); + }); + } + return questionSetECML; + }, + getConfig: function () { + var instance = this; + var config = instance._super(); + config.title = instance.config.title; + config.max_score = instance.config.max_score; + config.allow_skip = instance.config.allow_skip; + config.show_feedback = instance.config.show_feedback; + config.shuffle_questions = instance.config.shuffle_questions; + config.shuffle_options = instance.config.shuffle_options; + config.total_items = instance.config.total_items; + + return config; + }, + onConfigChange: function (key, value) { + var instance = this; + if (!_.isUndefined(value)) { + var itemLength = this.data.length; + switch (key) { + case 'title': + this.config.title = value; + this.editorObj._objects[1]._objects[0].setText(value.toUpperCase()); + break; + case 'total_items': + this.config.total_items = value; + this.editorObj._objects[1]._objects[1].setText(value + "/" + itemLength + "Questions,"); + break; + case 'max_score': + this.config.max_score = value; + this.editorObj._objects[1]._objects[2].setText(value + "Marks"); + break; + case 'shuffle_questions': + this.config.shuffle_questions = value; + if(value){ + var maxscore = this.config.shuffle_questions ? this.data.length : this.config.max_score; + this.editorObj._objects[1]._objects[2].setText(maxscore + " Marks"); + _.each(instance.data,function(val,key){ + if(val.body == undefined){ + instance.data[key].max_score = 1; + }else{ + var qBody = JSON.parse(instance.data[key].body); + qBody.data.config.metadata.max_score = 1; + qBody.data.config.max_score = 1; + instance.data[key].body = JSON.stringify(qBody); + instance.data[key].max_score = 1; + } + }); + this.config.max_score = instance.data.length; + ecEditor.dispatchEvent("org.ekstep.toaster:info", { + title: 'Each question will carry equal weightage of 1 mark when using Shuffle. To provide different weightage to individual questions please turn off Shuffle.', + position: 'topCenter', + }); + } + break; + case 'show_feedback': + this.config.show_feedback = value; + break; + case 'optionShuffle': + this.config.optionShuffle = value; + break; + case 'btn_edit': + ecEditor.dispatchEvent('delete:invoke'); + break; + } + } + ecEditor.render(); + ecEditor.dispatchEvent('object:modified', { + target: ecEditor.getEditorObject() + }); + }, + openQuestionBank: function (event, callback) { + var data; + if (ecEditor._.isUndefined(callback)) { + data = undefined; + } else { + callback = callback.callback; + data = { + data: ecEditor.getCurrentObject().data, + config: ecEditor.getCurrentObject().config + }; + } + + ecEditor.dispatchEvent('org.ekstep.questionbank:showpopup', { + callback: callback, + data: data + }); + }, + getSummary: function() { + var instance = this; + var summary = {'totalQuestions': 0,'totalScore': 0, 'questions': []}; + var totalQuestionsToRender = instance.config.total_items; + instance._questions.forEach(function(question,key) { + summary.questions.push({'identifier': question.identifier}); + }); + if(instance.config.shuffle_questions){ + // Total number of items/questions to render + summary.totalQuestions = totalQuestionsToRender; + summary.totalScore = totalQuestionsToRender; + }else{ + instance._questions.forEach(function(question,key) { + if(key < totalQuestionsToRender){ + if(question.body != undefined){ + var questionCount = JSON.parse(question.body).data.config.questionCount == undefined ? 1 : JSON.parse(question.body).data.config.questionCount; + var scoreCount = JSON.parse(question.body).data.config.max_score == undefined ? 1 : JSON.parse(question.body).data.config.max_score; + summary.totalQuestions = summary.totalQuestions + parseInt(questionCount); + summary.totalScore = summary.totalScore + parseInt(scoreCount); + }else{ + summary.totalQuestions = summary.totalQuestions + parseInt(1); + summary.totalScore = summary.totalScore + question.max_score; + } + } + }); + } + return summary; + }, + loadQSPlugins: function(){ + var instance = this; + var qsManifest = org.ekstep.pluginframework.pluginManager.getPluginManifest(instance.manifest.id); + var qsVesrion = qsManifest.ver.split('.')[0]; + var data = { + "request": { + "filters": { + "objectType": ["Content"], + "contentType": ["Plugin"], + "targets.id": instance.manifest.id, + "targets.ver": {'<=': Number(qsVesrion)}, + "status": "Live" + }, + "limit": 50, + "fields": ['contentType','semanticVersion','appIcon'] + } + }; + + var pluginsData; + if(_.isFunction(ecEditor.getService('search').pluginsSearch)){ + var url = ecEditor.getConfig('pluginsRepoUrl') ? ecEditor.getConfig('pluginsRepoUrl') : undefined; + ecEditor.getService('search').pluginsSearch(url, data, function(err, resp) { + if(!err){ + pluginsData = resp.data.result.content; + instance.pluginsRespHandler(pluginsData); + } + }); + }else{ + ecEditor.getService('search').search(data, function(err, resp) { + if(!err){ + pluginsData = resp.data.result.content; + instance.pluginsRespHandler(pluginsData); + } + }); + } + }, + pluginsRespHandler: function(pluginsData){ + var instance = this; + instance._plugins = pluginsData; + var plugins = []; + ecEditor._.forEach(pluginsData, function(value, key) { // eslint-disable-line no-unused-vars + if (value) { + var obj = { + "id": value.identifier, + "ver": value.semanticVersion, + "type": 'plugin' + } + plugins.push(obj); + } + }); + org.ekstep.pluginframework.pluginManager.loadAllPlugins(_.isArray(plugins) ? plugins : [plugins], []); + }, + getplugins: function(event, callback){ + var instance = this; + callback(instance._plugins); + } +}); +//# sourceURL=questionsetPlugin.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/style/style.css b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/style/style.css new file mode 100644 index 000000000..120834d85 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/editor/style/style.css @@ -0,0 +1,31 @@ +/*Questionset popup loading issue + while loading question set the full screen popup show +*/ +.ui.modal.qb-question-bank { + top: 0 !important; + left: 0 !important; + height: 100vh; + width: 100% !important; + margin: 0 auto; + border-radius: 0; + display: flex; + -webkit-flex-flow: column; + -moz-flex-flow: column; + -ms-flex-flow: column; + -o-flex-flow: column; + flex-flow: column; +} + +.qs-scrollbar::-webkit-scrollbar { + width: 10px; +} + +.qs-scrollbar::-webkit-scrollbar-thumb { + background-color: #c9c9c9; +} + +.qs-scrollbar::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + background-color: #F5F5F5; +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/gulpfile.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/gulpfile.js new file mode 100644 index 000000000..1a3fe411d --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/gulpfile.js @@ -0,0 +1 @@ +require('ekstep-content-plugin-dev-common/lib/gulp-tasks')(); \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/manifest.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/manifest.json new file mode 100644 index 000000000..eb3c549ae --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/manifest.json @@ -0,0 +1,140 @@ +{ + "id": "org.ekstep.questionset", + "ver": "1.0", + "author": "Manoj Chandrashekar", + "title": "Question Set Plugin", + "description": "Plugin to add question set to content", + "publishedDate": "", + "editor": { + "main": "editor/plugin.js", + "dependencies": [ + { + "type": "plugin", + "plugin": "org.ekstep.question", + "ver": "1.0" + }, + { + "type": "plugin", + "plugin": "org.ekstep.questionunit", + "ver": "1.1" + }, + { + "type": "plugin", + "plugin": "org.ekstep.questionbank", + "ver": "1.0" + }, + { + "type": "plugin", + "plugin": "org.ekstep.questionset.quiz", + "ver": "1.0" + }, + { + "type": "plugin", + "plugin": "org.ekstep.questionset.preview", + "ver": "1.0" + },{ + "type":"css", + "src":"editor/style/style.css" + } + ], + "menu": [ + { + "id": "question-set", + "category": "main", + "type": "icon", + "toolTip": "Add Question Set", + "title": "Question Set", + "iconClass": "icon-questions icon", + "onclick": { + "id": "org.ekstep.questionset:showPopup" + } + } + ], + "configManifest": [ + { + "PropertyName": "btn_edit", + "title": "Edit question set", + "description": "Choose a question from the question bank", + "dataType": "button", + "valueType": "text", + "required": true, + "onclick": { + "id": "org.ekstep.questionset:showPopup", + "type": "questionset" + } + }, + { + "propertyName": "title", + "title": "Question Set Title", + "description": "Question Set Title", + "dataType": "input", + "valueType": "text", + "required": true + }, + { + "propertyName": "shuffle_questions", + "title": "Shuffle Questions", + "description": "Shuffle the Questions", + "dataType": "boolean", + "required": true + }, + { + "propertyName": "show_feedback", + "title": "Show Immediate Feedback", + "description": "Show the feedback popup", + "dataType": "boolean", + "required": true + }, + { + "propertyName": "total_items", + "title": "Display", + "description": "Total questions to display", + "dataType": "input", + "valueType": "number", + "required": true, + "minimumValue": "0" + }, + { + "propertyName": "max_score", + "title": "Total Marks", + "description": "Maximum score", + "dataType": "input", + "valueType": "number", + "required": true, + "minimumValue": "1", + "maximumValue": "99" + } + ] + }, + "renderer": { + "main": "renderer/plugin.js", + "dependencies": [ + { + "type": "js", + "src": "renderer/utils/telemetry_logger.js" + }, + { + "type": "js", + "src": "renderer/utils/html_audio_plugin.js" + }, + { + "type": "js", + "src": "renderer/utils/qs_feedback_popup.js" + } + ] + }, + "dependencies": [ + { + "plugin": "org.ekstep.questionset.quiz", + "ver": "1.0", + "type": "plugin", + "scope": "renderer" + }, + { + "type": "plugin", + "plugin": "org.ekstep.iterator", + "ver": "1.0", + "scope":"renderer" + } + ] +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/package.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/package.json new file mode 100644 index 000000000..07e6f6b6b --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/package.json @@ -0,0 +1,9 @@ +{ + "name": "org.ekstep.questionset", + "scripts": { + "build": "npm install && node bin/updateFrameworkDependencies.js && gulp" + }, + "devDependencies": { + "ekstep-content-plugin-dev-common": "ekstep/ekstep-content-plugin-dev-common" + } +} diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/plugin.js new file mode 100644 index 000000000..f436a73f9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/plugin.js @@ -0,0 +1,480 @@ +/** + * Plugin to create repo instance and to register repo instance + * @extends EkstepRenderer.Plugin + * @author sachin.kumar@goodworklabs.com> + */ +org.ekstep.questionsetRenderer = IteratorPlugin.extend({ // eslint-disable-line no-undef + _type: 'org.ekstep.questionset', + _isContainer: true, + _render: true, + _questionSetConfig: { + 'total_items': 1, + 'show_feedback': true, + 'shuffle_questions': false + }, + _masterQuestionSet: [], + _itemIndex: -1, + _renderedQuestions: [], + _questionStates: {}, + _firstQuestion: false, + _lastQuestion: false, + _currentQuestion: undefined, + _currentQuestionState: undefined, + _stageObject: undefined, + _displayedPopup: false, + _constants: { + questionPluginId: 'org.ekstep.question', + qsElement: '#questionset', + qsPopup:'qs-feedback-model-popup', + questionsetCSS: { + width: '100%', + position: 'absolute', + top: '0%', + left: 0, + height: '100%' + }, + feedbackCSS: { + position: 'absolute', + width: '100%', + height: '100%', + 'z-index': 999999, + top: 0, + display: 'none' + }, + qsPrefix: 'qs', + qsQuizPlugin: 'org.ekstep.questionset.quiz' + }, + _questionUnitPlugins: [], + initPlugin: function(data) { + var instance = this; + + /** + * TODO: Remove the following FIX. + * The following fix is applied to remove duplicate naviagtion registrations by questionset plugin. + * This can be removed after https://github.com/ekstep/CE-Core-Plugins/pull/1262 is deployed. + */ + + org.ekstep.pluginframework.pluginManager.plugins['org.ekstep.navigation'].p.prototype._customNavigationPlugins = org.ekstep.pluginframework.pluginManager.plugins['org.ekstep.navigation'].p.prototype._customNavigationPlugins.filter(function(p) { + return p && (p.id != instance._data.id); + }); + + /** + * End of FIX + */ + + // De-Register for any existing navigation hooks (replay scenario) + this.deregisterNavigation(instance); + + // On content replay, reset all question set information. + EkstepRendererAPI.addEventListener('renderer:content:replay', function() { + instance.resetQS(); + }, instance); + // Remove duplicate event listener + EventBus.listeners['org.ekstep.questionset:feedback:retry'] = []; + EkstepRendererAPI.addEventListener('org.ekstep.questionset:feedback:retry', function() { + this._displayedPopup = false; + }, instance); + // Event handler to save question state + EventBus.listeners['org.ekstep.questionset:saveQuestionState'] = undefined; + /*EkstepRendererAPI.addEventListener(instance._data.pluginType + ':saveQuestionState', function(event) { + var state = event.target; + if (instance._currentQuestion) { + instance.saveQuestionState(instance._currentQuestion.id, state); + } + }, this);*/ + // Load the DOM container that houses the unit templates + this.loadTemplateContainer(); + this._questionSetConfig = this._data.config ? JSON.parse(this._data.config.__cdata) : this._questionSetConfig; + if(this._questionSetConfig.shuffle_questions){ + this._questionSetConfig.max_score = this._questionSetConfig.total_items; + } + QSTelemetryLogger.qsConfig = this._questionSetConfig; + if(data.isQuestionPreview){ + // get navigation plugin instance & empty all customNavigation object of it + org.ekstep.pluginframework.pluginManager.plugins['org.ekstep.navigation'].p.prototype._customNavigationPlugins=[] + } + // this.setupNavigation(); + // Get all questions in the question set + var quesArray = JSON.parse(JSON.stringify(data[this._constants.questionPluginId])); + //if question set have one question then convert from object to array for device issue + this._masterQuestionSet = _.isArray(quesArray) ? quesArray : [quesArray]; + // If this isn't the first time the question set is being rendered, restore its earlier state + this._questionStates = {}; + this._renderedQuestions = []; + var question = undefined; + var savedQSState = this.getQuestionSetState(); + + EkstepRendererAPI.addEventListener("renderer:plugin:reset", function(e) { + this.reInstateQuestionsOnReview(e.target.data); + }, this); + + var savedCurrentQuestion = this.questionExistInQS(savedQSState); + if (savedQSState && savedCurrentQuestion) { + this._renderedQuestions = savedQSState.renderedQuestions; + question = savedQSState.currentQuestion; + this._questionStates = savedQSState.questionStates; + this._currentQuestionState = this.getQuestionState(question.id); + this._itemIndex = savedQSState.itemIndex >= 0 ? savedQSState.itemIndex : -1; + } else { + question = this.getNextQuestion(); + } + if(this._itemIndex > 0){ + EventBus.dispatch("renderer:previous:enable"); + } + + // Register for navigation hooks + this.registerNavigation(instance); + + this.saveQuestionSetState(); + // Render the question + this.renderQuestion(question); + }, + renderQuestion: function(question) { + var instance = this; + // If this is not the first question, hide the current question + if (instance._currentQuestion) { + EkstepRendererAPI.dispatchEvent(instance._currentQuestion.pluginId + ':hide', instance); + jQuery('#' + instance._currentQuestion.id).remove(); + } + if (question.pluginId === this._constants.qsQuizPlugin) { + //if question is quiz then remove question set div + this.removeTemplateContainer(); + // Mark the question as rendered + instance._currentQuestion = question; + this.setRendered(question); + // Set current question for telmetry to log events from question-unit + QSTelemetryLogger.setQuestion(instance._currentQuestion, instance.getRenderedIndex()+1); // eslint-disable-line no-undef + // For V1 questions, invoke the 'questionset.quiz' plugin. + // TODO: Move state saving of V1 questions from questionset.quiz to here, like V2 questions + PluginManager.invoke(question.pluginId, question, this._stage, this._stage, this._theme); + Renderer.update = true; + } else { + this.loadTemplateContainer(); + // Mark the question as rendered + instance._currentQuestion = question; + // For V2 questions, load the AngularJS template and controller and invoke the event to render the question + // Fetch the question state if it was already rendered before + this._currentQuestionState = this.getQuestionState(question.id); + + // Set current question for telmetry to log events from question-unit + this.setRendered(question); + this.saveQuestionSetState(); + QSTelemetryLogger.setQuestion(instance._currentQuestion, instance.getRenderedIndex()+1); // eslint-disable-line no-undef + EkstepRendererAPI.dispatchEvent(question.pluginId + ':show', instance); + } + }, + setRendered: function(question) { + var instance = this, + element; + // Mark the question as rendered in the _masterQuestionSet + // This is to ensure that we do not re-render the same question twice (in case of shuffle) + element = _.find(instance._masterQuestionSet, function(item) { + return item.id === question.id; + }); + element.rendered = true; + // Add the rendered question to the _renderedQuestions array - this will be saved for future + // when the question set may be re-rendered when revisiting the stage + // This array also helps in navigation between already rendered questions. + var renderedQuestion = _.find(instance._renderedQuestions, function(q) { + return q.id === question.id + }); + if (_.isUndefined(renderedQuestion)) { + instance._renderedQuestions.push(question); + } + // Set first/last question flags + // this._firstQuestion = (this.getRenderedIndex() === 0); + // this._lastQuestion = (this._renderedQuestions.length + 1 >= this._questionSetConfig.total_items); + this._itemIndex = this.getRenderedIndex(); + }, + endOfQuestionSet: function() { + return (this._renderedQuestions.length >= this._questionSetConfig.total_items); + }, + nextQuestion: function() { + // Trigger the evaluation for the question + var instance = this; + + if (!this._displayedPopup) { + EkstepRendererAPI.dispatchEvent(this._currentQuestion.pluginId + ":evaluate", function(result) { + var pluginInstance = org.ekstep.pluginframework.pluginManager.pluginObjs[instance._currentQuestion.pluginId]; + // pluginInstance._question.overrideFeedbackPopUp = false; + if(!result.eval && !_.isUndefined(result.evalRequired) && !result.evalRequired){ + instance.renderNextQuestion(); + }else{ + if(!pluginInstance._question.overrideFeedbackPopUp){ + QSTelemetryLogger.logEvent(QSTelemetryLogger.EVENT_TYPES.ASSESSEND, result); + instance.saveQuestionState(instance._currentQuestion.id, result.state); + instance._displayedPopup = true; + } + if(instance._currentQuestionState && _.isEqual(instance._currentQuestionState.val, result.state.val)){ + instance.renderNextQuestion(); + } else { + instance.saveQuestionState(instance._currentQuestion.id, result.state); + if(pluginInstance._question.overrideFeedbackPopUp){ + instance.renderNextQuestion(); + }else if (instance._questionSetConfig.show_feedback == true) { + // Display feedback popup (tryagain or goodjob) + // result.pass is added to handle sorting-template(Custom IEvaluator) issue. This can be generic solution for other + instance.displayFeedback(result); + } else { + // If show_feedback is set to false, move to next question without displaying feedback popup + instance.renderNextQuestion(); + } + } + } + }, this); + } else { + this._displayedPopup = false; + instance.renderNextQuestion(); + } + }, + displayFeedback: function(result) { + var res = result.eval ? result.eval : result.pass; + if (res === true) { + QSFeedbackPopup.showGoodJob(); // eslint-disable-line no-undef + } else { + if (result.score > 0) { + var earnedScore; + if((!isNaN(result.score) && result.score.toString().indexOf('.') != -1)){ + var precisionLen = this.precision(result.score); + earnedScore = precisionLen > 1 ? result.score.toFixed(2) : result.score; + }else{ + earnedScore = result.score; + } + var partialScoreRes = parseFloat(earnedScore) + '/' + result.max_score; + QSFeedbackPopup.qsPartialCorrect(partialScoreRes); // eslint-disable-line no-undef + } + else { + QSFeedbackPopup.showTryAgain(); // eslint-disable-line no-undef + } + } + this._displayedPopup = true; + }, + precision: function(a) { + if (!isFinite(a)) return 0; + var e = 1, p = 0; + while (Math.round(a * e) / e !== a) { e *= 10; p++; } + return p; + }, + renderNextQuestion: function() { + // Get the next question to be rendered + var instance = this; + var nextQ = this.getNextQuestion(); + if (nextQ) { + this.renderQuestion(nextQ); + this.generateNavigateTelemetry(null, this._currentQuestion.id); + } else { + // If no question is remaining, it is the end of the question set, move to next stage after + // hiding the last question and some housekeeping + this.saveQuestionSetState(); + this.generateNavigateTelemetry('next', 'ContentApp-EndScreen'); + EkstepRendererAPI.dispatchEvent(this._currentQuestion.pluginId + ':hide', instance); + this.resetListeners(); + this.resetTemplates(); + if (!this._displayedPopup) { + this.deregisterNavigation(this); + } + OverlayManager.skipAndNavigateNext(); + } + }, + prevQuestion: function() { + this.renderPrevQuestion(); + }, + renderPrevQuestion: function() { + // Get the previous question to be rendered + var instance = this; + var prevQ = this.getPrevQuestion(); + if (prevQ) { + this.renderQuestion(prevQ); + this.generateNavigateTelemetry(null, this._currentQuestion); + } else { + // If no question is remaining, it is the beginning of the question set, move to previous stage after + // hiding the first question and some housekeeping + this.saveQuestionSetState(); + this.generateNavigateTelemetry('previous', 'ContentApp-StartScreen'); + EkstepRendererAPI.dispatchEvent(this._currentQuestion.pluginId + ':hide', instance); + // this.resetNavigation(); + this.resetListeners(); + this.resetTemplates(); + this.deregisterNavigation(this); + OverlayManager.navigatePrevious(); + } + }, + getNextQuestion: function() { + // Check if the next question has already been rendered (are we moving back and forth within the question set?) + var renderIndex = this.getRenderedIndex(); + if ((renderIndex + 1 >= this._renderedQuestions.length) && !this.endOfQuestionSet()) { + // The next question should be picked from the master question array, so fetch the list of all questions + // that are NOT marked as 'rendered' + var unRenderedQuestions = this._masterQuestionSet.filter(function(q) { + return (_.isUndefined(q.rendered)) ? true : !q.rendered; + }); + // If shuffle is on, return a random question from the list of NOT rendered questions + if (this._questionSetConfig.shuffle_questions) { + var ques = _.sample(unRenderedQuestions); + ques = this.updateMaxScore(this._questionSetConfig.shuffle_questions, ques); + return ques; + } + // If shuffle is off, return the next question in the list + return unRenderedQuestions.shift(); + } else { + // If the next question has already been rendered, fetch it from the _renderedQuestions array + return this._renderedQuestions[renderIndex + 1]; + } + }, + updateMaxScore: function(shuffle, question){ + // Update max-score of the question, when shuffle on + if(shuffle){ + questionConfigData = JSON.parse(question.config.__cdata); + questionData = JSON.parse(question.data.__cdata); + if(questionConfigData.metadata){ //checks the question is v2 ( metadata property exists only for v2 quesions) + questionConfigData.max_score = 1; + questionConfigData.metadata.max_score = 1; + question.config.__cdata = JSON.stringify(questionConfigData); + } else { // handling v1 question + _.each(questionData.questionnaire.item_sets, function(iSet){ + questionData.questionnaire.items[iSet.id][0].max_score = 1; + question.data.__cdata = JSON.stringify(questionData); + }) + } + } + return question; + }, + getPrevQuestion: function() { + // The previous question is always obtained from the _renderedQuestions array. + // If the index becomes < 0, it means that we have already returned the first question + // and can go back any further + var renderIndex = this.getRenderedIndex(); + if (renderIndex - 1 < 0) { + return undefined; + } + return this._renderedQuestions[renderIndex - 1]; + }, + getRenderedIndex: function() { + var instance = this; + var index = _.findIndex(this._renderedQuestions, function(q) { + return q.id === instance._currentQuestion.id; + }); + return index; + }, + //remove question set div inside the game area + removeTemplateContainer:function(){ + $(this._constants.qsElement).remove(); + }, + //add questionset div inside the game Area + loadTemplateContainer: function() { + var qsElement = $('
', { + id: this._constants.qsElement.replace('#', ''), + class: '' + }).css(this._constants.questionsetCSS); + if ($(this._constants.qsElement).length === 0) { + var qsFeedback = $('
', { + id: this._constants.qsPopup, + }).css(this._constants.feedbackCSS); + $("#gameArea").append(qsElement); + $("#gameArea").append(qsFeedback); + } + }, + getQuestionState: function(questionId) { + return this._questionStates[questionId]; + }, + getQuestionSetState: function() { + return Renderer.theme.getParam(this._data.id); + }, + saveQuestionState: function(questionId, state) { + if (state) { + var qsState = this.getQuestionSetState(); + qsState = _.isUndefined(qsState) ? {} : qsState; + this._questionStates[questionId] = state; + qsState.questionStates = this._questionStates; + Renderer.theme.setParam(this._data.id, JSON.parse(JSON.stringify(qsState))); + } + }, + saveQuestionSetState: function() { + var qsState = { + masterQuestionSet: this._masterQuestionSet, + renderedQuestions: this._renderedQuestions, + currentQuestion: this._currentQuestion, + questionStates: this._questionStates, + itemIndex: this._itemIndex + }; + Renderer.theme.setParam(this._data.id, JSON.parse(JSON.stringify(qsState))); + }, + reInstateQuestionsOnReview: function(param) { + if(param) { + var qssState = Renderer.theme.getParam(this._data.id); + qssState.currentQuestion = this._masterQuestionSet[0]; + Renderer.theme.setParam(this._data.id, qssState); + } + }, + resetTemplates: function() { + // Remove all templates loaded for the question set + jQuery(this._constants.qsElement).remove(); + }, + resetQS: function() { + var instance = this; + Renderer.theme.setParam(this._data.id, undefined); + this.removeDuplicateEventListeners('renderer:content:replay', instance._data.id); + instance.resetListeners(); + }, + resetListeners: function() { + // The following code will unregister all event listeners added by the question unit plugins + // This is to ensure that the event listeners do not overlap when there are two or more question sets + // in the same content. + _.forEach(this._questionUnitPlugins, function(value){ + for (var key in EventBus.listeners) { + if (key.indexOf(value) !== -1) { + if (EventBus.listeners.hasOwnProperty(key)) { + EventBus.listeners[key] = undefined; + } + } + } + }) + + }, + generateNavigateTelemetry: function(buttonId, currentQuestion) { + var stageTo, objid; + var stageid = EkstepRendererAPI.getCurrentStageId(); + if (buttonId) { + stageTo = EkstepRendererAPI.getCurrentStage().getParam(buttonId); + objid = stageTo; + objid = objid ? objid : currentQuestion; + stageTo = stageTo ? stageTo : currentQuestion; + } else { + stageTo = stageid; + objid = currentQuestion; + } + var data = { + "type": "view", + "subtype": "Paginate", + "pageid": stageid, + "uri": "", + "visits": { + "objid": objid, + "objtype": "" + } + }; + TelemetryService.navigate(stageid, stageTo, data); // eslint-disable-line no-undef + }, + handleNext: function() { + this.nextQuestion(); + }, + handlePrevious: function() { + this.prevQuestion(); + }, + removeDuplicateEventListeners: function(event, id) { + EventBus.listeners[event] = EventBus.listeners[event].filter(function(e) { + if(e.scope && e.scope.id) { + return e.scope.id != id; + } + return true; + }); + }, + questionExistInQS: function(savedQSState){ + if(savedQSState) { + return _.any(savedQSState.masterQuestionSet, function(item){ return _.isEqual(item.id, savedQSState.currentQuestion.id); }) + } else { + return false; + } + } +}); +//# sourceURL=questionSetRenderer.js diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/html_audio_plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/html_audio_plugin.js new file mode 100644 index 000000000..a85418c3c --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/html_audio_plugin.js @@ -0,0 +1,57 @@ +var HTMLAudioPlayer = { + _audios : {}, + _audioLimit : 25, + removeOldest: function() { + //equvalent of _.sortBy(this._audios['lastUsed']) and removes first one in _audios) + var oldestAudio = Object.keys(this._audios)[0]; + for(var audio in this._audios) { + if(this._audios[audio].lastUsed < this._audios[oldestAudio].lastUsed){ + oldestAudio = audio; + } + } + delete this._audios[oldestAudio]; + }, + getInstance: function(url, loop) { + if(!this._audios[url]) { + if(Object.keys(this._audios).length == this._audioLimit) { + this.removeOldest(); + } + this._audios[url] = new Audio(url); + } + if(typeof(loop) === "boolean") + this._audios[url].loop = loop; + this._audios[url].lastUsed = + new Date() //returns current timestamp + return this._audios[url]; + }, + play: function (url) { + this.getInstance(url, false).play(); + }, + pause: function(url) { + this.getInstance(url).pause(); + }, + loop: function(url) { + this.getInstance(url, true).play(); + }, + togglePlay: function(url) { + var audioIns = this.getInstance(url); + if(audioIns.paused){ + this.pauseAll(); + audioIns.play() + }else{ + audioIns.pause() + } + }, + stop: function(url) { + var audioIns = this.getInstance(url); + audioIns.pause(); + audioIns.currentTime = 0; + }, + pauseAll: function() { + _.each(this._audios, function(audioIns){ + if(!audioIns.paused){ + audioIns.pause(); + } + }) + } +} + diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/qs_feedback_popup.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/qs_feedback_popup.js new file mode 100644 index 000000000..fe098275b --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/qs_feedback_popup.js @@ -0,0 +1,56 @@ +var QSFeedbackPopup = {}; +/** + * Show Good job success model popup on navigation + * @memberof org.ekstep.questionset.qs_feedback_popup# + */ +QSFeedbackPopup.showGoodJob = function() { + var goodJobTemplate = _.template(''); + $("#qs-feedback-model-popup").html(goodJobTemplate); + $("#qs-feedback-model-popup").show(); +} +/** + * Hide the model popup on navigation + * @memberof org.ekstep.questionset.qs_feedback_popup# + */ +QSFeedbackPopup.hidePopup = function() { + $("#qs-feedback-model-popup").hide(); +} +/** + * move to next stage or next question + * @memberof org.ekstep.questionset.qs_feedback_popup# + */ +QSFeedbackPopup.moveToNextStage = function() { + EkstepRendererAPI.dispatchEvent('renderer:navigation:next'); + QSTelemetryLogger.logEvent(QSTelemetryLogger.EVENT_TYPES.TOUCH, { type: QSTelemetryLogger.EVENT_TYPES.TOUCH, id: 'button-next' }); + QSFeedbackPopup.hidePopup(); +} +/** + * show try again model popup on navigation + * @memberof org.ekstep.questionset.qs_feedback_popup# + */ +QSFeedbackPopup.showTryAgain = function() { + var tryAgainTemplate = _.template(''); + $("#qs-feedback-model-popup").html(tryAgainTemplate); + $("#qs-feedback-model-popup").show(); +} +/** + * hide try again model popup on navigation + * @memberof org.ekstep.questionset.qs_feedback_popup# + */ +QSFeedbackPopup.showRetry = function() { + EkstepRendererAPI.dispatchEvent('org.ekstep.questionset:feedback:retry'); + QSTelemetryLogger.logEvent(QSTelemetryLogger.EVENT_TYPES.TOUCH, { type: QSTelemetryLogger.EVENT_TYPES.TOUCH, id: 'button-retry' }); + QSFeedbackPopup.hidePopup(); +} +/* + * Show partialscore model popup + * @memberof org.ekstep.questionset.qs_feedback_popup# + * @param { string } partialScoreRes. + */ +QSFeedbackPopup.qsPartialCorrect = function(partialScoreRes) { + var partialTemplate = _.template(''); + var partialelement = partialTemplate({ score: partialScoreRes }); + $("#qs-feedback-model-popup").html(partialelement); + $("#qs-feedback-model-popup").show(); +} +//# sourceURL=goodJob.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/telemetry_logger.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/telemetry_logger.js new file mode 100644 index 000000000..bc881c66a --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/renderer/utils/telemetry_logger.js @@ -0,0 +1,114 @@ +var TelemetryService = TelemetryService || {}; +var QSTelemetryLogger = { + EVENT_TYPES: { + TOUCH: 'TOUCH', + DRAG: 'DRAG', + RESPONSE: 'RESPONSE', + ASSESS: 'ASSESS', + ASSESSEND: 'ASSESSEND' + }, + _plugin: {}, + _question: {}, + _assessStart: {}, + _qData: {}, + _qConfig: {} +}; +QSTelemetryLogger.setQuestion = function(ques, index) { + //Set by Question-set while rendering a new question + this._plugin = EkstepRendererAPI.getPluginObjs(ques.pluginId); + this._question = ques; + this._question.index = index; + + var qData = this._question.data.__cdata || this._question.data; + this._qData = JSON.parse(qData); + + var qConfig = this._question.config.__cdata || this._question.config; + this._qConfig = JSON.parse(qConfig); +}; +QSTelemetryLogger.logInteract = function(data) { + TelemetryService.interact(data.type, data.id, data.type, { stageId: Renderer.theme._currentStage }); +}; +QSTelemetryLogger.logResponse = function(data) { + var edata = { + "target": { + "id": this._qConfig.metadata.identifier ? this._qConfig.metadata.identifier : (this._question.id || ""), + "ver": this._qConfig.metadata.version ? this._qConfig.metadata.version.toString() : "1.0", + "type": "AssessmentItem" + }, + "optionTag": data.type, + "res": data.values + }; + TelemetryService.itemResponse(edata); +}; +QSTelemetryLogger.logAssess = function() { + var instance = this; + var qsetConfig = QSTelemetryLogger.qsConfig; + if (this._qData.questionnaire) { + for (var quesIdentifier in this._qData.questionnaire.items) { + if (this._qData.questionnaire.items.hasOwnProperty(quesIdentifier)) { + var maxscore = (qsetConfig.shuffle_questions) ? 1 : this._qData.questionnaire.items[quesIdentifier][0].max_score; + this._assessStart = TelemetryService.assess(this._question.id, this._qData.questionnaire.items[quesIdentifier][0].language, this._qData.questionnaire.items[quesIdentifier][0].qlevel, { maxscore: maxscore }).start(); + } + } + } else { + var maxscore = (qsetConfig.shuffle_questions) ? 1 : this._qConfig.max_score; + this._assessStart = TelemetryService.assess(this._question.id, this._qConfig.metadata.medium, this._qConfig.metadata.qlevel, { maxscore: maxscore }).start(); + } +}; +QSTelemetryLogger.logAssessEnd = function(result) { + var quesTitle, quesDesc, quesScore; + if (this._qData.questionnaire) { + for (var quesIdentifier in this._qData.questionnaire.items) { + if (this._qData.questionnaire.items.hasOwnProperty(quesIdentifier)) { + quesTitle = this._qData.questionnaire.items[quesIdentifier][0].title; + quesDesc = this._qData.questionnaire.items[quesIdentifier][0].description; + quesScore = result.pass != 0 ? this._qData.questionnaire.items[quesIdentifier][0].max_score : 0; + } + } + } + else{ + quesTitle = this._qConfig.metadata.title; + quesDesc = this._qConfig.metadata.description ? this._qConfig.metadata.description : ''; + quesScore = parseFloat((result.score).toFixed(2)); + } + var data = { + eventVer: "3.1", + type: result.type, + pass: result.eval, + score: quesScore, + res: result.values, + params: result.params, + qindex: this._question.index, + qtitle: quesTitle, + qdesc: quesDesc, + mc: [], + mmc: [] + }; + TelemetryService.assessEnd(this._assessStart, data); +}; +QSTelemetryLogger.logEvent = function(type, data) { + try { + switch (type.toUpperCase()) { + case this.EVENT_TYPES.TOUCH: + this.logInteract(data); + break; + case this.EVENT_TYPES.DRAG: + this.logInteract(data); + break; + case this.EVENT_TYPES.ASSESS: + this.logAssess(); + break; + case this.EVENT_TYPES.RESPONSE: + this.logResponse(data); + break; + case this.EVENT_TYPES.ASSESSEND: + this.logAssessEnd(data); + break; + case 'DEFAULT': + return true; + } + } catch (e) { + console.log("telemetry_logger -> logEvent()", e); + } +}; +//# sourceURL=telemetryLogger.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/editor/plugin.spec.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/editor/plugin.spec.js new file mode 100644 index 000000000..32ffd3af1 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/editor/plugin.spec.js @@ -0,0 +1,640 @@ +describe("EditorPlugin", function() { + + var plugin, fabricGroup, v1Data, v2Data, v2Data1,ApiResponse,stage,newData,config,multiData,originalTimeout,ecmlObj; + beforeAll(function(done){ + ContentEditorTestFramework.init(function() { + originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + stage = ecEditor.instantiatePlugin("org.ekstep.stage"); + config = ecEditor.instantiatePlugin("org.ekstep.config"); + plugin= ecEditor.instantiatePlugin("org.ekstep.questionset"); + ecmlObj = ecEditor.instantiatePlugin("org.ekstep.viewecml"); + done(); + }); + }); + + afterAll(function() { + jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; + }); + + beforeEach(function() { + v2Data = [{ "template": "NA", "itemType": "UNIT", "code": "NA", "subject": "domain", "qlevel": "EASY", "channel": "in.ekstep", "description": "test", "language": ["English"], "type": "mcq", "title": "test image and audio for the image", "body": "{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.0\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"test image and audio for the image\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"test1\",\"image\":\"\",\"audio\":\"/assets/public/content/145503359952511.mp3\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:3278\"},{\"text\":\"test2\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:3279\"}],\"media\":[{\"id\":566752436,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":576331075,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":94711675,\"src\":\"/assets/public/content/145503359952511.mp3\",\"assetId\":\"11_sound\",\"type\":\"audio\",\"preload\":false}]},\"config\":{\"metadata\":{\"category\":\"MCQ\",\"title\":\"test image and audio for the image\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Kindergarten\"],\"concepts\":[\"BIO3\"],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":false,\"layout\":\"Horizontal\",\"isShuffleOption\":false},\"media\":[{\"id\":566752436,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":576331075,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":94711675,\"src\":\"/assets/public/content/145503359952511.mp3\",\"assetId\":\"11_sound\",\"type\":\"audio\",\"preload\":false}]}}", "createdOn": "2018-03-23T10:15:24.824+0000", "gradeLevel": ["Grade 1"], "appId": "ekstep_portal", "options": [{ "answer": true, "value": { "type": "text", "asset": "1", "resvalue": 0, "resindex": 0 } }], "lastUpdatedOn": "2018-03-23T10:15:24.824+0000", "identifier": "do_112466586622558208121", "question": "test image and audio for the image", "consumerId": "f6878ac4-e9c9-4bc4-80be-298c5a73b447", "version": 2, "versionKey": "1521800124824", "createdBy": "580", "max_score": 1, "name": "test image and audio for the image", "template_id": "NA", "category": "MCQ", "status": "Live", "$$hashKey": "object:2719", "isSelected": true }]; + v2Data1 = [{ "body": "{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.0\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"test image and audio for the image\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"test1\",\"image\":\"\",\"audio\":\"/assets/public/content/145503359952511.mp3\",\"hint\":\"\",\"isCorrect\":true,\"},{\"text\":\"test2\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\",\"isCorrect\":false,\"}]},\"config\":{\"metadata\":{\"category\":\"MCQ\",\"title\":\"test image and audio for the image\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Kindergarten\"],\"concepts\":[\"BIO3\"],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":false,\"layout\":\"Horizontal\",\"isShuffleOption\":false},\"}}", "createdOn": "2018-03-23T10:15:24.824+0000", "gradeLevel": ["Grade 1"], "appId": "ekstep_portal", "options": [{ "answer": true, "value": { "type": "text", "asset": "1", "resvalue": 0, "resindex": 0 } }], "identifier": "do_112466586622558208121", "question": "test", "consumerId": "f6878ac4-e9c9-4bc4-80be-298c5a73b447", "version": 2, "versionKey": "1521800124824", "createdBy": "580", "max_score": 1, "name": "test image and audio for the image", "template_id": "NA", "category": "MCQ", "isSelected": true }]; + v1Data = [{ "template": [{ "text": { "event": { "action": [{ "asset_model": "item.question_audio", "sound": true, "type": "command", "command": "stop" }, { "asset_model": "item.question_audio", "type": "command", "command": "play" }], "type": "click" }, "color": "#4c4c4c", "w": 100, "h": 15, "x": 0, "fontsize": "3vw", "y": 10, "lineHeight": 1.4, "model": "item.question", "valign": "top", "align": "center" }, "shape": { "event": { "action": [{ "asset_model": "item.question_audio", "sound": true, "type": "command", "command": "stop" }, { "asset_model": "item.question_audio", "type": "command", "command": "play" }], "type": "click" }, "hitArea": true, "w": 100, "h": 24, "x": 0, "y": 10, "type": "rect" }, "g": [{ "placeholder": [{ "model-count": "item.optionCount1", "w": 30, "h": 100, "x": 0, "y": 0, "valign": "middle", "align": "center", "type": "gridLayout", "model-asset": "item.question_image" }, { "model-count": "item.optionCount2", "w": 30, "h": 100, "x": 40, "y": 0, "valign": "middle", "align": "center", "type": "gridLayout", "model-asset": "item.question_image" }], "text": [{ "color": "#4c4c4c", "w": 5, "h": 0, "x": 32, "fontsize": "3vw", "y": 55, "model": "item.operator1", "valign": "middle", "align": "center" }, { "color": "#4c4c4c", "w": 5, "h": 0, "x": 72, "fontsize": "3vw", "y": 55, "model": "item.operator2", "valign": "middle", "align": "center" }, { "z-index": 30, "color": "#4c4c4c", "w": 20, "h": 40, "x": 80, "fontsize": "3vw", "y": 38, "model": "item.ans1", "valign": "middle", "id": "newText1", "align": "center" }], "g": { "shape": { "w": 100, "h": 100, "x": 0, "y": 0, "stroke-width": 3, "fill": "#FFFFA5", "type": "roundrect", "stroke": "#719ECE" }, "z-index": 20, "w": 20, "h": 40, "x": 80, "y": 34, "id": "textshape1" }, "w": 100, "h": 32, "x": 0, "y": 33 }, { "nkeyboard": { "keys": "item.keys", "w": 100, "h": 25, "limit": 7, "x": 0, "y": 82, "id": "bKeyboard", "type": "custom", "target": "newText1" }, "w": 100, "h": 100, "x": 0, "y": 0 }], "id": "Operations_with_images" }], "itemType": "UNIT", "code": "org.ekstep.assessmentitem.literacy_5abb516b8f224", "subject": "domain", "qlevel": "EASY", "channel": "in.ekstep", "description": "", "language": ["English"], "media": [{ "id": "do_11246090113921843213", "type": "image", "src": "https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg", "asset_id": "do_11246090113921843213" }], "type": "ftb", "title": "v1 - operations with images", "createdOn": "2018-03-28T08:25:15.611+0000", "gradeLevel": ["Kindergarten"], "appId": "ekstep_portal", "question_image": "do_11246090113921843213", "lastUpdatedOn": "2018-03-28T08:25:15.611+0000", "used_for": "worksheet", "model": { "optionCount1": "4", "optionCount2": "3", "operator1": "-", "operator2": "=", "keys": "0,1,2,3,4,5,6,7,8,9,+,-,×,÷,=,<,>,/,." }, "lastUpdatedBy": "597", "identifier": "do_112470071423893504143", "question": "v1 - operations with images", "consumerId": "f6878ac4-e9c9-4bc4-80be-298c5a73b447", "version": 1, "versionKey": "1522225515611", "answer": { "ans1": { "value": "1", "score": 1 } }, "concepts": [{ "identifier": "LO4", "name": "Understanding of Grammar/Syntax", "objectType": "Concept", "relation": "associatedTo", "description": null, "index": null, "status": null, "depth": null, "mimeType": null, "visibility": null, "compatibilityLevel": null }], "createdBy": "597", "max_score": 1, "domain": ["literacy"], "name": "v1 - operations with images", "template_id": "do_112470023566245888128", "category": "MCQ", "status": "Live", "isSelected": true, "mediamanifest": { "media": [{ "id": "do_11246090113921843213", "type": "image", "src": "https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg", "asset_id": "do_11246090113921843213" }, { "src": "https://dev.ekstep.in/assets/public/content/do_112470023566245888128/assets/1522219674003/customnumkeyboard.js", "id": "nkeyboard", "type": "plugin", "plugin": "org.ekstep.questionset", "ver": "1.0" }, { "src": "https://dev.ekstep.in/assets/public/content/do_112470023566245888128/assets/1522219674010/numerickeyboard.css", "id": "keyboard_css", "type": "css", "plugin": "org.ekstep.questionset", "ver": "1.0" }] } }]; + v1DataQuestion = {"questionnaire":{"items":{"do_112470071423893504143":[{"itemType":"UNIT","code":"org.ekstep.assessmentitem.literacy_5abb516b8f224","subject":"domain","qlevel":"EASY","channel":"in.ekstep","description":"","language":["English"],"media":[{"id":"do_11246090113921843213","type":"image","src":"https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg","asset_id":"do_11246090113921843213"}],"type":"ftb","title":"v1 - operations with images","createdOn":"2018-03-28T08:25:15.611+0000","gradeLevel":["Kindergarten"],"appId":"ekstep_portal","question_image":"do_11246090113921843213","lastUpdatedOn":"2018-03-28T08:25:15.611+0000","used_for":"worksheet","model":{"optionCount1":"4","optionCount2":"3","operator1":"-","operator2":"=","keys":"0,1,2,3,4,5,6,7,8,9,+,-,×,÷,=,<,>,/,."},"lastUpdatedBy":"597","identifier":"do_112470071423893504143","question":"v1 - operations with images","consumerId":"f6878ac4-e9c9-4bc4-80be-298c5a73b447","version":1,"versionKey":"1522225515611","answer":{"ans1":{"value":"1","score":1}},"concepts":[{"identifier":"LO4","name":"Understanding of Grammar/Syntax","objectType":"Concept","relation":"associatedTo","description":null,"index":null,"status":null,"depth":null,"mimeType":null,"visibility":null,"compatibilityLevel":null}],"createdBy":"597","max_score":1,"domain":["literacy"],"name":"v1 - operations with images","template_id":"do_112470023566245888128","category":"MCQ","status":"Live","isSelected":true,"template":"Operations_with_images"}]},"item_sets":[{"count":1,"id":"do_112470071423893504143"}],"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1,"btn_edit":"Edit"},"template":[{"text":{"event":{"action":[{"asset_model":"item.question_audio","sound":true,"type":"command","command":"stop"},{"asset_model":"item.question_audio","type":"command","command":"play"}],"type":"click"},"color":"#4c4c4c","w":100,"h":15,"x":0,"fontsize":"3vw","y":10,"lineHeight":1.4,"model":"item.question","valign":"top","align":"center"},"shape":{"event":{"action":[{"asset_model":"item.question_audio","sound":true,"type":"command","command":"stop"},{"asset_model":"item.question_audio","type":"command","command":"play"}],"type":"click"},"hitArea":true,"w":100,"h":24,"x":0,"y":10,"type":"rect"},"g":[{"placeholder":[{"model-count":"item.optionCount1","w":30,"h":100,"x":0,"y":0,"valign":"middle","align":"center","type":"gridLayout","model-asset":"item.question_image"},{"model-count":"item.optionCount2","w":30,"h":100,"x":40,"y":0,"valign":"middle","align":"center","type":"gridLayout","model-asset":"item.question_image"}],"text":[{"color":"#4c4c4c","w":5,"h":0,"x":32,"fontsize":"3vw","y":55,"model":"item.operator1","valign":"middle","align":"center"},{"color":"#4c4c4c","w":5,"h":0,"x":72,"fontsize":"3vw","y":55,"model":"item.operator2","valign":"middle","align":"center"},{"z-index":30,"color":"#4c4c4c","w":20,"h":40,"x":80,"fontsize":"3vw","y":38,"model":"item.ans1","valign":"middle","id":"newText1","align":"center"}],"g":{"shape":{"w":100,"h":100,"x":0,"y":0,"stroke-width":3,"fill":"#FFFFA5","type":"roundrect","stroke":"#719ECE"},"z-index":20,"w":20,"h":40,"x":80,"y":34,"id":"textshape1"},"w":100,"h":32,"x":0,"y":33},{"nkeyboard":{"keys":"item.keys","w":100,"h":25,"limit":7,"x":0,"y":82,"id":"bKeyboard","type":"custom","target":"newText1"},"w":100,"h":100,"x":0,"y":0}],"id":"Operations_with_images"}]}; + plugin.config = { + "title": "test", + "max_score": 1, + "allow_skip": true, + "show_feedback": true, + "shuffle_questions": false, + "shuffle_options": false, + "total_items": 1, + "btn_edit": "Edit" + } + newData = [ + { + "template": "NA", + "templateType": "Horizontal", + "itemType": "UNIT", + "isPartialScore": true, + "code": "NA", + "subject": "domain", + "qlevel": "MEDIUM", + "evalUnordered": false, + "channel": "0126089810590679040", + "language": [ + "English" + ], + "title": "gg dfgdfgdfg\n", + "type": "mcq", + "body": "{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.1\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"

gg dfgdfgdfg

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"

g

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:787\"},{\"text\":\"

t

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:788\"}],\"questionCount\":0,\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"gg dfgdfgdfg\\n\",\"title\":\"gg dfgdfgdfg\\n\",\"category\":\"MCQ\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}", + "createdOn": "2019-02-19T09:37:39.559+0000", + "isShuffleOption": false, + "appId": "qa.Upgrade-lms.portal", + "options": [ + { + "answer": true, + "value": { + "type": "text", + "asset": "1", + "resvalue": 0, + "resindex": 0 + } + } + ], + "lastUpdatedOn": "2019-02-19T09:37:39.559+0000", + "identifier": "do_21270226173590732811047", + "consumerId": "298450cb-c202-45f0-adee-9224c7612f35", + "version": 2, + "versionKey": "1550569059559", + "framework": "jdf1", + "createdBy": "4f0656c1-df55-4e27-911c-cb79fc1bd611", + "max_score": 1, + "name": "gg dfgdfgdfg\n", + "template_id": "NA", + "category": "MCQ", + "status": "Live", + "isSelected": true, + "$$hashKey": "object:1985" + } + ] + multiData = {"data":[{"template":"NA","templateType":"Horizontal","itemType":"UNIT","isPartialScore":true,"code":"NA","subject":"domain","qlevel":"MEDIUM","evalUnordered":false,"channel":"0125410296672829440","language":["English"],"title":"Weekend is here.\n","type":"mcq","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.1\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"

Weekend is here.

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"

Yay

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:853\"},{\"text\":\"

Nay

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:854\"}],\"questionCount\":0,\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"Weekend is here.\\n\",\"title\":\"Weekend is here.\\n\",\"category\":\"MCQ\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-02-22T10:55:46.303+0000","isShuffleOption":false,"appId":"staging.Staging-lms.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-02-22T10:55:46.303+0000","identifier":"do_212704423496122368142","consumerId":"298450cb-c202-45f0-adee-9224c7612f35","version":2,"versionKey":"1550832946303","framework":"jdf1","createdBy":"7378e45c-0928-4c4a-8a10-9b363246293a","max_score":1,"name":"Weekend is here.\n","template_id":"NA","category":"MCQ","status":"Live","isSelected":true,"$$hashKey":"object:1995"},{"template":"NA","templateType":"Horizontal","itemType":"UNIT","isPartialScore":true,"code":"NA","subject":"domain","qlevel":"MEDIUM","evalUnordered":false,"channel":"0126089810590679040","language":["English"],"title":"gg dfgdfgdfg\n","type":"mcq","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.1\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"

gg dfgdfgdfg

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"

g

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:787\"},{\"text\":\"

t

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:788\"}],\"questionCount\":0,\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"gg dfgdfgdfg\\n\",\"title\":\"gg dfgdfgdfg\\n\",\"category\":\"MCQ\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-02-19T09:37:39.559+0000","isShuffleOption":false,"appId":"qa.Upgrade-lms.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-02-19T09:37:39.559+0000","identifier":"do_21270226173590732811047","consumerId":"298450cb-c202-45f0-adee-9224c7612f35","version":2,"versionKey":"1550569059559","framework":"jdf1","createdBy":"4f0656c1-df55-4e27-911c-cb79fc1bd611","max_score":1,"name":"gg dfgdfgdfg\n","template_id":"NA","category":"MCQ","status":"Live","isSelected":true,"$$hashKey":"object:2007"}],"config":{"title":"test","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":2}}; + plugin.data = newData;; + ImageResponce = {"type":"image","originX":"left","originY":"top","left":72,"top":12.15,"width":785,"height":513,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"src":"http://localhost:9876/base/org.ekstep.questionset-1.0/editor/assets/quizimage.png","filters":[],"resizeFilters":[]} + ApiResponse = { + "data": { + "id": "ekstep.composite-search.search", + "ver": "3.0", + "ts": "2019-02-13T11:07:33ZZ", + "params": { + "resmsgid": "3874b0df-4a71-47af-9998-6c524bba10f9", + "msgid": null, + "err": null, + "status": "successful", + "errmsg": null + }, + "responseCode": "OK", + "result": { + "count": 5, + "content": [ + { + "identifier": "org.ekstep.questionunit.mcq", + "appIcon": "https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/org.ekstep.questionunit.mcq/artifact/assetsmcq-horizontal_805_1529387605_1529387605429.thumb.png", + "semanticVersion": "1.1", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.mtf", + "appIcon": "https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/org.ekstep.questionunit.mtf/artifact/assetsimage-2018-06-08_1_805_1528451134_1528451134793.thumb.png", + "semanticVersion": "1.1", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.ftb", + "appIcon": "https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/org.ekstep.questionunit.ftb/artifact/assetsimage-2018-06-08_805_1533130614_1533130614398.thumb.png", + "semanticVersion": "1.0", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.reorder", + "appIcon": "https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/org.ekstep.questionunit.reorder/artifact/assetsreorder-preview_725_1536562584_1536562584692.thumb.png", + "semanticVersion": "1.0", + "contentType": "Plugin", + "objectType": "Content" + }, + { + "identifier": "org.ekstep.questionunit.sequence", + "appIcon": "https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/org.ekstep.questionunit.sequence/artifact/assetssequencial-preview_786_1536564290_1536564290560.thumb.png", + "semanticVersion": "1.0", + "contentType": "Plugin", + "objectType": "Content" + } + ] + }, + "responseTime": 151 + } + }; + plugin.manifest.id = "org.ekstep.questionset"; + plugin.manifest.ver = "1.0"; + spyOn(plugin, "loadQSPlugins").and.callThrough(); + spyOn(plugin, "getplugins").and.callThrough(); + spyOn(plugin, 'postInit').and.callThrough(); + spyOn(plugin, 'getPropsForEditor').and.callThrough(); + spyOn(plugin, 'addMedia').and.callThrough(); + spyOn(plugin, 'createEcmlStructureV1').and.callThrough(); + spyOn(plugin, 'toECML').and.callThrough(); + spyOn(plugin, 'addQS').and.callThrough(); + spyOn(plugin, 'openQuestionBank').and.callThrough(); + spyOn(ecEditor, "dispatchEvent").and.callThrough(); + spyOn(plugin, "onConfigChange").and.callThrough(); + spyOn(ecEditor, 'render').and.callThrough(); + }); + + describe("initialize", function() { + beforeEach(function() { + plugin.data = v1Data; + spyOn(ecEditor, "loadAndInitPlugin").and.callThrough(); + spyOn(plugin, "pluginsRespHandler").and.callThrough(); + }); + + it("should load and initialize dependancy plugins when pluginsSearch false", function(done) { + ecEditor.getService('search').pluginsSearch = undefined; + ecEditor.getService('search').search = jasmine.createSpy().and.callFake(function(data, callBack) { + callBack(undefined, ApiResponse); + done(); + }); + plugin.initialize(); + expect(ecEditor.loadAndInitPlugin).toHaveBeenCalled(); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mcq'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mtf'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.ftb'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.reorder'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.sequence'); + }); + it("should load and initialize dependancy plugins when pluginsSearch true", function(done) { + ecEditor.getService('search').pluginsSearch = jasmine.createSpy().and.callFake(function(url, data, callBack) { + callBack(undefined, ApiResponse); + done(); + }); + plugin.initialize(); + expect(ecEditor.loadAndInitPlugin).toHaveBeenCalled(); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mcq'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mtf'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.ftb'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.reorder'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.sequence'); + }); + + + it("should call loadQSPlugins", function() { + plugin.initialize(); + plugin.loadQSPlugins(); + expect(plugin.loadQSPlugins).toHaveBeenCalled(); + }); + + it("should call getplugins", function(event) { + plugin.initialize(); + var callback = function(){}; + // plugin.getplugins(event,callback); + expect(plugin.getplugins).toHaveBeenCalled(); + }); + + it("should call pluginsRespHandler", function(done) { + ecEditor.getService('search').pluginsSearch = jasmine.createSpy().and.callFake(function(url, data, callBack) { + callBack(undefined, ApiResponse); + done(); + }); + plugin.initialize(); + expect(plugin.pluginsRespHandler).toHaveBeenCalled(); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mcq'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.mtf'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.ftb'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.reorder'); + expect(JSON.stringify(org.ekstep.pluginframework.pluginManager.pluginObjs)).toContain('org.ekstep.questionunit.sequence'); + }); + }); + + describe("new instance of questionset", function() { + beforeEach(function() { + if(stage.children.length>0){ + stage.children = []; + } + }); + + it('should create new instance add media', function(done) { + plugin.data = newData; + var v1NewData = {"data":{"data":[{"template":[{"org.ekstep.plugins.funtoot.genericitemrenderer":{"w":100,"h":100,"x":0,"y":0,"rotate":"","id":"44cce289-b407-4628-9900-8adbb67b2386"},"id":"funtoot.template.01"}],"itemType":"UNIT","code":"QFIB02230","keywords":["mcq"],"qtype":"mcq","subject":"Mathematics","qlevel":"MEDIUM","channel":"in.ekstep","language":["English"],"medium":"English","type":"mcq","title":"","qid":"QFIB02230","createdOn":"2018-02-01T06:55:09.970+0000","qindex":"","question_audio":"","gradeLevel":["Class 5"],"appId":"ekstep_portal","options":[{"value":{"type":"text","asset":"OPT_0","audio":"","count":null,"resvalue":0,"resindex":0},"answer":true,"mh":"MH_0","mmc":[]},{"value":{"type":"text","asset":"OPT_1","audio":"","count":null,"resvalue":1,"resindex":1},"answer":false,"mh":"MH_1","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_2","audio":"","count":null,"resvalue":2,"resindex":2},"answer":false,"mh":"MH_2","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_3","audio":"","count":null,"resvalue":3,"resindex":3},"answer":false,"mh":"MH_3","mmc":["FC130"]}],"lastUpdatedOn":"2019-02-19T09:26:05.444+0000","used_for":"worksheet","model":{"hintMsg":"HINT_ID","numericLangId":"en","langId":"en","variables":[],"mcqType":8},"state":"Verified","subLevel":"","identifier":"QFIB02230","question":"QUESTION_TEXT","level":2,"consumerId":"ec175d89-64b0-4e23-9f81-076e4d379a8f","author":"funtoot","portalOwner":"562","version":1,"i18n":"{\"en\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\",\"HINT_ID\":\"For addition of like fractions, add the numerators only. Denominator remains the same.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` equals to:\",\"MH_0\":\"\",\"MH_1\":\"Add the numerators of all the fractions correctly.\",\"MH_2\":\"Do not multiply the numerators. Add them.\",\"MH_3\":\"This is the reciprocal of the answer.\",\"NO_ANSWER\":\"Click the answer and then press the submit button\"},\"ta\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"HINT_ID\":\"ஒத்த பின்னங்களின் கூடுதலானது, தொகுதிகளின் கூடுதல் மட்டுமே.பகுதி மாறாது.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` =\",\"MH_0\":\"\",\"MH_1\":\"அனைத்து பின்னங்களின் தொகுதிகளை சரியாக கூட்டவும்\",\"MH_2\":\"தொகுதிகளை பெருக்காமல் கூட்டவும்\",\"MH_3\":\"இதுவே தலைகிழ் மதிப்பாகும்.\",\"NO_ANSWER\":\"தயவுசெய்து பதிலளிக்கவும்\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\\n\"}}","versionKey":"1550568365444","tags":["mcq"],"question_count":1,"framework":"NCF","answer":{},"grade":["5"],"domain":"Numeracy","max_score":5,"name":"QFIB02230","sublevel":1,"num_answers":1,"template_id":"do_2125053652669235201268","category":"MCQ","bloomsTaxonomyLevel":"Understand","status":"Live","isSelected":true,"$$hashKey":"object:2661","mediamanifest":{"media":[{"id":"9c9bc62c-cc13-4191-bbee-57ec2a4b1dca","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js","type":"js"},{"id":"7922b23d-7d68-4d20-a004-1ca223750316","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html","type":"js"},{"id":"org.ekstep.navigation","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.navigation_manifest","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/manifest.json","type":"json"},{"id":"polyglot","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/polyglot.js","type":"js"},{"id":"org.ekstep.plugins.i18n","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.i18n_manifest","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/manifest.json","type":"json"},{"id":"keyboardcss","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard.css","type":"css"},{"id":"org.ekstep.plugins.common.keyboard","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.common.keyboard_manifest","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/manifest.json","type":"json"},{"id":"generators","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/generators.js","type":"js"},{"id":"eraser","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/eraser.png","type":"image"},{"id":"seq","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/seq.png","type":"image"},{"id":"semitrans","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/semitrans.png","type":"image"},{"id":"zoom-in","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/zoom.png","type":"image"},{"id":"plus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/plus_white.png","type":"image"},{"id":"minus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/minus_white.png","type":"image"},{"id":"micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"micro-hint-mdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"html-micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"drop-down","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/drop-down-icon.png","type":"image"},{"id":"org.ekstep.funtoot.hint-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/hint.png","type":"image"},{"id":"org.ekstep.funtoot.solution-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/solimg.png","type":"image"},{"id":"close","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/close.png","type":"image"},{"id":"submit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/icn_submit.png","type":"image"},{"id":"undo","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/undo.png","type":"image"},{"id":"clearall","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/clearall.png","type":"image"},{"id":"disabledsubmit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/disabled_submit.png","type":"image"},{"id":"org.ekstep.funtoot.asset.next","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/next.png","type":"image"},{"id":"editable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/editable.png","type":"image"},{"id":"nonEditable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/noneditable.png","type":"image"},{"id":"additioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/additioneval.js","type":"js"},{"id":"fractioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fractioneval.js","type":"js"},{"id":"multiplicationeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/multiplicationeval.js","type":"js"},{"id":"divisioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/divisioneval.js","type":"js"},{"id":"clockcontrol","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/clockcontrol.js","type":"plugin"},{"id":"numberlineeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlineeval.js","type":"js"},{"id":"mathquill","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.js","type":"js"},{"id":"mathjs","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/math.min.js","type":"js"},{"id":"mathquill-basic","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.css","type":"css"},{"id":"genericmdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/genericmdd.css","type":"css"},{"id":"zoomableImageStyle","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/zoomableimage.css","type":"css"},{"id":"mathtext","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathtext.js","type":"plugin"},{"id":"mathedit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathedit.js","type":"plugin"},{"id":"org.ekstep.funtoot.ftPlugin","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbaseplugin.js","type":"plugin"},{"id":"nkeyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/customnumkeyboard.js","type":"plugin"},{"id":"keyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"fibblankprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fibblankprocessor.js","type":"plugin"},{"id":"ftbdropdownprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbdropdownprocessor.js","type":"plugin"},{"id":"org.ekstep.funtoot.zoomableImage","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/zoomableimage.js","type":"plugin"},{"id":"defaultkeyboardadapter","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/defaultkeyboardadapter.js","type":"plugin"},{"id":"ftFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfib.js","type":"plugin"},{"id":"ftPluginHelper","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpluginhelper.js","type":"plugin"},{"id":"org.ekstep.funtoot.grid","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/grid.js","type":"plugin"},{"id":"org.ekstep.funtoot.table","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/table.js","type":"plugin"},{"id":"keyboard_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/numerickeyboard.css","type":"css"},{"id":"htmlpopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/htmlpopupplugin.js","type":"plugin"},{"id":"htmlpopup_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/htmlpopup.css","type":"css"},{"id":"htmlpopup_js","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/scripts/htmlpopup.js","type":"js"},{"id":"ftMicroHint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftmicrohint.js","type":"plugin"},{"id":"ftPopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpopup.js","type":"plugin"},{"id":"ftAttempts","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftattempts.js","type":"plugin"},{"id":"inlineFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/inlinefib.js","type":"plugin"},{"id":"numberlinenumber","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlinenumber.js","type":"plugin"},{"id":"numberline","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberline.js","type":"plugin"},{"id":"org.ekstep.funtoot.option","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/option.js","type":"plugin"},{"id":"org.ekstep.funtoot.optionBuilder","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/optionbuilder.js","type":"plugin"},{"id":"org.ekstep.funtoot.common","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfibbaseplugin.js","type":"plugin"},{"id":"org.ekstep.funtoot.common_manifest","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/renderer/fibwordproblem.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem_manifest","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericfib","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericfib_manifest","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmfr","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmfr_manifest","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmdd","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmdd_manifest","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmcq","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmcq_manifest","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/manifest.json","type":"json"},{"id":"connector","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/asset/connector.png","type":"image"},{"id":"org.ekstep.plugins.funtoot.genericmtf","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmtf_manifest","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericseq","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericseq_manifest","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer_manifest","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/manifest.json","type":"json"}]}}],"config":{"title":"test","max_score":5,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}} + var data1 = v1NewData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance.media.QuizImage).toBeTruthy(); + var qdata1 = { "data": data1.data, "config": { __cdata: JSON.stringify(dataObj.data.config) } }; + expect(ecEditor.dispatchEvent).toHaveBeenCalledWith(plugin.manifest.id + ':create', qdata1); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + + }); + it('should create new instance with MCQ question', function(done) { + plugin.data = newData; + var v1NewData = {"data":{"data":[{"template":[{"org.ekstep.plugins.funtoot.genericitemrenderer":{"w":100,"h":100,"x":0,"y":0,"rotate":"","id":"44cce289-b407-4628-9900-8adbb67b2386"},"id":"funtoot.template.01"}],"itemType":"UNIT","code":"QFIB02230","keywords":["mcq"],"qtype":"mcq","subject":"Mathematics","qlevel":"MEDIUM","channel":"in.ekstep","language":["English"],"medium":"English","type":"mcq","title":"","qid":"QFIB02230","createdOn":"2018-02-01T06:55:09.970+0000","qindex":"","question_audio":"","gradeLevel":["Class 5"],"appId":"ekstep_portal","options":[{"value":{"type":"text","asset":"OPT_0","audio":"","count":null,"resvalue":0,"resindex":0},"answer":true,"mh":"MH_0","mmc":[]},{"value":{"type":"text","asset":"OPT_1","audio":"","count":null,"resvalue":1,"resindex":1},"answer":false,"mh":"MH_1","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_2","audio":"","count":null,"resvalue":2,"resindex":2},"answer":false,"mh":"MH_2","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_3","audio":"","count":null,"resvalue":3,"resindex":3},"answer":false,"mh":"MH_3","mmc":["FC130"]}],"lastUpdatedOn":"2019-02-19T09:26:05.444+0000","used_for":"worksheet","model":{"hintMsg":"HINT_ID","numericLangId":"en","langId":"en","variables":[],"mcqType":8},"state":"Verified","subLevel":"","identifier":"QFIB02230","question":"QUESTION_TEXT","level":2,"consumerId":"ec175d89-64b0-4e23-9f81-076e4d379a8f","author":"funtoot","portalOwner":"562","version":1,"i18n":"{\"en\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\",\"HINT_ID\":\"For addition of like fractions, add the numerators only. Denominator remains the same.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` equals to:\",\"MH_0\":\"\",\"MH_1\":\"Add the numerators of all the fractions correctly.\",\"MH_2\":\"Do not multiply the numerators. Add them.\",\"MH_3\":\"This is the reciprocal of the answer.\",\"NO_ANSWER\":\"Click the answer and then press the submit button\"},\"ta\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"HINT_ID\":\"ஒத்த பின்னங்களின் கூடுதலானது, தொகுதிகளின் கூடுதல் மட்டுமே.பகுதி மாறாது.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` =\",\"MH_0\":\"\",\"MH_1\":\"அனைத்து பின்னங்களின் தொகுதிகளை சரியாக கூட்டவும்\",\"MH_2\":\"தொகுதிகளை பெருக்காமல் கூட்டவும்\",\"MH_3\":\"இதுவே தலைகிழ் மதிப்பாகும்.\",\"NO_ANSWER\":\"தயவுசெய்து பதிலளிக்கவும்\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\\n\"}}","versionKey":"1550568365444","tags":["mcq"],"question_count":1,"framework":"NCF","answer":{},"grade":["5"],"domain":"Numeracy","max_score":5,"name":"QFIB02230","sublevel":1,"num_answers":1,"template_id":"do_2125053652669235201268","category":"MCQ","bloomsTaxonomyLevel":"Understand","status":"Live","isSelected":true,"$$hashKey":"object:2661","mediamanifest":{"media":[{"id":"9c9bc62c-cc13-4191-bbee-57ec2a4b1dca","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js","type":"js"},{"id":"7922b23d-7d68-4d20-a004-1ca223750316","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html","type":"js"},{"id":"org.ekstep.navigation","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.navigation_manifest","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/manifest.json","type":"json"},{"id":"polyglot","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/polyglot.js","type":"js"},{"id":"org.ekstep.plugins.i18n","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.i18n_manifest","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/manifest.json","type":"json"},{"id":"keyboardcss","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard.css","type":"css"},{"id":"org.ekstep.plugins.common.keyboard","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.common.keyboard_manifest","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/manifest.json","type":"json"},{"id":"generators","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/generators.js","type":"js"},{"id":"eraser","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/eraser.png","type":"image"},{"id":"seq","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/seq.png","type":"image"},{"id":"semitrans","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/semitrans.png","type":"image"},{"id":"zoom-in","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/zoom.png","type":"image"},{"id":"plus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/plus_white.png","type":"image"},{"id":"minus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/minus_white.png","type":"image"},{"id":"micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"micro-hint-mdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"html-micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"drop-down","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/drop-down-icon.png","type":"image"},{"id":"org.ekstep.funtoot.hint-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/hint.png","type":"image"},{"id":"org.ekstep.funtoot.solution-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/solimg.png","type":"image"},{"id":"close","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/close.png","type":"image"},{"id":"submit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/icn_submit.png","type":"image"},{"id":"undo","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/undo.png","type":"image"},{"id":"clearall","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/clearall.png","type":"image"},{"id":"disabledsubmit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/disabled_submit.png","type":"image"},{"id":"org.ekstep.funtoot.asset.next","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/next.png","type":"image"},{"id":"editable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/editable.png","type":"image"},{"id":"nonEditable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/noneditable.png","type":"image"},{"id":"additioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/additioneval.js","type":"js"},{"id":"fractioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fractioneval.js","type":"js"},{"id":"multiplicationeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/multiplicationeval.js","type":"js"},{"id":"divisioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/divisioneval.js","type":"js"},{"id":"clockcontrol","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/clockcontrol.js","type":"plugin"},{"id":"numberlineeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlineeval.js","type":"js"},{"id":"mathquill","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.js","type":"js"},{"id":"mathjs","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/math.min.js","type":"js"},{"id":"mathquill-basic","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.css","type":"css"},{"id":"genericmdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/genericmdd.css","type":"css"},{"id":"zoomableImageStyle","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/zoomableimage.css","type":"css"},{"id":"mathtext","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathtext.js","type":"plugin"},{"id":"mathedit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathedit.js","type":"plugin"},{"id":"org.ekstep.funtoot.ftPlugin","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbaseplugin.js","type":"plugin"},{"id":"nkeyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/customnumkeyboard.js","type":"plugin"},{"id":"keyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"fibblankprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fibblankprocessor.js","type":"plugin"},{"id":"ftbdropdownprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbdropdownprocessor.js","type":"plugin"},{"id":"org.ekstep.funtoot.zoomableImage","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/zoomableimage.js","type":"plugin"},{"id":"defaultkeyboardadapter","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/defaultkeyboardadapter.js","type":"plugin"},{"id":"ftFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfib.js","type":"plugin"},{"id":"ftPluginHelper","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpluginhelper.js","type":"plugin"},{"id":"org.ekstep.funtoot.grid","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/grid.js","type":"plugin"},{"id":"org.ekstep.funtoot.table","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/table.js","type":"plugin"},{"id":"keyboard_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/numerickeyboard.css","type":"css"},{"id":"htmlpopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/htmlpopupplugin.js","type":"plugin"},{"id":"htmlpopup_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/htmlpopup.css","type":"css"},{"id":"htmlpopup_js","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/scripts/htmlpopup.js","type":"js"},{"id":"ftMicroHint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftmicrohint.js","type":"plugin"},{"id":"ftPopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpopup.js","type":"plugin"},{"id":"ftAttempts","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftattempts.js","type":"plugin"},{"id":"inlineFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/inlinefib.js","type":"plugin"},{"id":"numberlinenumber","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlinenumber.js","type":"plugin"},{"id":"numberline","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberline.js","type":"plugin"},{"id":"org.ekstep.funtoot.option","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/option.js","type":"plugin"},{"id":"org.ekstep.funtoot.optionBuilder","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/optionbuilder.js","type":"plugin"},{"id":"org.ekstep.funtoot.common","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfibbaseplugin.js","type":"plugin"},{"id":"org.ekstep.funtoot.common_manifest","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/renderer/fibwordproblem.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem_manifest","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericfib","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericfib_manifest","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmfr","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmfr_manifest","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmdd","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmdd_manifest","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmcq","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmcq_manifest","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/manifest.json","type":"json"},{"id":"connector","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/asset/connector.png","type":"image"},{"id":"org.ekstep.plugins.funtoot.genericmtf","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmtf_manifest","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericseq","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericseq_manifest","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer_manifest","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/manifest.json","type":"json"}]}}],"config":{"title":"test","max_score":5,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}} + var data1 = v1NewData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance._questions[0].qtype).toEqual('mcq'); + done(); + }, 500); + }); + it('should create new instance with AIS question', function(done) { + plugin.data = newData; + var aisData = {"data":{"data":[{"template":"NA","templateType":"Horizontal","isPartialScore":true,"itemType":"UNIT","code":"NA","subject":"Mathematics","evalUnordered":false,"qlevel":"EASY","channel":"b00bc992ef25f1a9a8d63291e20efc8d","language":["English"],"medium":"English","type":"mcq","title":"Test Arrange\n","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.sequence\",\"version\":\"1.0\",\"templateId\":\"sequenceTemplate\"},\"data\":{\"question\":{\"text\":\"

Test Arrange

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"Test\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"$$hashKey\":\"object:3472\"},{\"text\":\"Arrange\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"$$hashKey\":\"object:3473\"}],\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"Test Arrange\\n\",\"title\":\"Test Arrange\\n\",\"medium\":\"English\",\"topic\":[],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Grade 1\"],\"subject\":\"Mathematics\",\"board\":\"NCERT\",\"category\":\"mcq\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-03-19T10:19:53.300+0000","gradeLevel":["Grade 1"],"isShuffleOption":false,"appId":"dev.sunbird.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-03-19T10:19:53.300+0000","identifier":"do_112722100578721792128","consumerId":"9393568c-3a56-47dd-a9a3-34da3c821638","version":2,"versionKey":"1552990793300","framework":"NCFCOPY","createdBy":"390","max_score":1,"name":"Test Arrange\n","template_id":"NA","category":"mcq","board":"NCERT","status":"Live","isSelected":true,"$$hashKey":"object:4536"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}}; + var data1 = aisData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance._questions[0].category).toEqual('mcq'); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + }); + it('should create new instance with reorder question', function(done) { + plugin.data = newData; + var reorderData = {"data":{"data":[{"template":"NA","templateType":"Horizontal","isPartialScore":true,"itemType":"UNIT","code":"NA","subject":"English","evalUnordered":false,"qlevel":"EASY","channel":"b00bc992ef25f1a9a8d63291e20efc8d","language":["English"],"medium":"English","type":"mcq","title":"Test Reordering\n","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.reorder\",\"version\":\"1.0\",\"templateId\":\"reorderingtemplate\"},\"data\":{\"question\":{\"text\":\"

Test Reordering

\\n\"},\"sentence\":{\"text\":\"Test Reordering\",\"tabs\":[{\"text\":\"Test\",\"id\":0,\"$$hashKey\":\"object:3249\"},{\"text\":\"Reordering\",\"id\":1,\"$$hashKey\":\"object:3250\"}]}},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"Test Reordering\\n\",\"title\":\"Test Reordering\\n\",\"qlevel\":\"EASY\",\"gradeLevel\":[\"Kindergarten\",\"Grade 1\"],\"topic\":[],\"subject\":\"English\",\"medium\":\"English\",\"board\":\"NCERT\",\"category\":\"mcq\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false}}}","createdOn":"2019-03-19T10:18:15.567+0000","gradeLevel":["Kindergarten","Grade 1"],"isShuffleOption":false,"appId":"dev.sunbird.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-03-19T10:18:15.567+0000","identifier":"do_112722099778093056127","consumerId":"9393568c-3a56-47dd-a9a3-34da3c821638","version":2,"versionKey":"1552990695567","framework":"NCFCOPY","createdBy":"390","max_score":1,"name":"Test Reordering\n","template_id":"NA","category":"mcq","board":"NCERT","status":"Live","isSelected":true,"$$hashKey":"object:5447"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}}; + var data1 = reorderData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance._questions[0].category).toEqual('mcq'); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + }); + it('should create new instance with FTB question', function(done) { + plugin.data = newData; + var ftbData = {"data":{"data":[{"template":"NA","templateType":"Horizontal","isPartialScore":true,"itemType":"UNIT","code":"NA","data":"{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"medium\":\"English\",\"topic\":[],\"qlevel\":\"MEDIUM\",\"gradeLevel\":[\"Grade 1\"],\"subject\":\"English\",\"board\":\"NCERT\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"medium\":\"English\",\"questionTitle\":\"test____\\n\",\"qlevel\":\"MEDIUM\",\"subject\":\"English\",\"board\":\"NCERT\",\"gradeLevel\":[\"Grade 1\"],\"templateType\":\"Horizontal\",\"isPartialScore\":true,\"isShuffleOption\":false,\"evalUnordered\":false,\"max_score\":1,\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"medium\":\"English\",\"questionTitle\":\"test____\\n\",\"qlevel\":\"MEDIUM\",\"subject\":\"English\",\"board\":\"NCERT\",\"gradeLevel\":[\"Grade 1\"],\"templateType\":\"Horizontal\",\"isPartialScore\":true,\"isShuffleOption\":false,\"evalUnordered\":false,\"max_score\":1,\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]}","subject":"English","evalUnordered":false,"qlevel":"MEDIUM","channel":"b00bc992ef25f1a9a8d63291e20efc8d","language":["English"],"medium":"English","type":"ftb","title":"Test FTB____","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.ftb\",\"version\":\"1.0\",\"templateId\":\"ftbtemplate\"},\"data\":{\"question\":{\"text\":\"

Test FTB[[test]]

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Device\",\"customKeys\":[]}},\"answer\":[\"test\"],\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"medium\":\"English\",\"topic\":[],\"qlevel\":\"MEDIUM\",\"gradeLevel\":[\"Grade 1\"],\"subject\":\"English\",\"board\":\"NCERT\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"medium\":\"English\",\"questionTitle\":\"test____\\n\",\"qlevel\":\"MEDIUM\",\"subject\":\"English\",\"board\":\"NCERT\",\"gradeLevel\":[\"Grade 1\"],\"templateType\":\"Horizontal\",\"isPartialScore\":true,\"isShuffleOption\":false,\"evalUnordered\":false,\"max_score\":1,\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"medium\":\"English\",\"questionTitle\":\"test____\\n\",\"qlevel\":\"MEDIUM\",\"subject\":\"English\",\"board\":\"NCERT\",\"gradeLevel\":[\"Grade 1\"],\"templateType\":\"Horizontal\",\"isPartialScore\":true,\"isShuffleOption\":false,\"evalUnordered\":false,\"max_score\":1,\"name\":\"test____\\n\",\"title\":\"test____\\n\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]},\"medium\":\"English\",\"questionTitle\":\"test____\\n\",\"qlevel\":\"MEDIUM\",\"subject\":\"English\",\"board\":\"NCERT\",\"gradeLevel\":[\"Grade 1\"],\"templateType\":\"Horizontal\",\"isPartialScore\":true,\"isShuffleOption\":false,\"evalUnordered\":false,\"max_score\":1,\"name\":\"Test FTB____\",\"title\":\"Test FTB____\",\"category\":\"FTB\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[{\"id\":\"org.ekstep.keyboard.eras_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/eras_icon.png\",\"assetId\":\"org.ekstep.keyboard.eras_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.language_icon\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/language_icon.png\",\"assetId\":\"org.ekstep.keyboard.language_icon\",\"type\":\"image\",\"preload\":true},{\"id\":\"org.ekstep.keyboard.hide_keyboard\",\"src\":\"/plugins/org.ekstep.keyboard-1.1/renderer/assets/keyboard.svg\",\"assetId\":\"org.ekstep.keyboard.hide_keyboard\",\"type\":\"image\",\"preload\":true}]}}","createdOn":"2019-03-15T09:34:04.643+0000","gradeLevel":["Grade 1"],"isShuffleOption":false,"appId":"dev.sunbird.portal","lastUpdatedOn":"2019-03-19T09:56:52.017+0000","identifier":"do_11271924690653184012","questionTitle":"test____\n","consumerId":"9393568c-3a56-47dd-a9a3-34da3c821638","version":2,"versionKey":"1552989412017","framework":"NCFCOPY","answer":[{"answer":true,"value":{"type":"text","asset":"1"}}],"createdBy":"390","max_score":1,"name":"Test FTB____","template_id":"NA","category":"FTB","board":"NCERT","status":"Live","$$hashKey":"object:1126"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}} + var data1 = ftbData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance._questions[0].type).toEqual('ftb'); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + }); + it('should create new instance with mtf question', function(done) { + plugin.data = newData; + var mtfData = {"data":{"data":[{"template":"NA","templateType":"Horizontal","isPartialScore":true,"itemType":"UNIT","code":"NA","subject":"Mathematics","evalUnordered":false,"qlevel":"EASY","channel":"b00bc992ef25f1a9a8d63291e20efc8d","language":["English"],"medium":"English","type":"mtf","title":"Test MTF\n","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mtf\",\"version\":\"1.1\",\"templateId\":\"horizontalMTF\"},\"data\":{\"question\":{\"text\":\"

Test MTF

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"option\":{\"optionsLHS\":[{\"text\":\"

ans1

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"index\":1,\"$$hashKey\":\"object:1144\"},{\"text\":\"

ans2

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"index\":2,\"$$hashKey\":\"object:1145\"},{\"text\":\"

ans3

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"index\":3,\"$$hashKey\":\"object:1146\"}],\"optionsRHS\":[{\"text\":\"

ans1

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"mapIndex\":1},{\"text\":\"

ans2

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"mapIndex\":2},{\"text\":\"

ans3

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"mapIndex\":3}],\"questionCount\":0},\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"Test MTF\\n\",\"title\":\"Test MTF\\n\",\"medium\":\"English\",\"topic\":[],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Grade 1\"],\"subject\":\"Mathematics\",\"board\":\"NCERT\",\"category\":\"MTF\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-03-19T09:53:56.064+0000","gradeLevel":["Grade 1"],"isShuffleOption":false,"appId":"dev.sunbird.portal","lastUpdatedOn":"2019-03-19T09:53:56.064+0000","rhs_options":[{"value":{"type":"mixed","text":"इक","image":"","count":"","audio":"","resvalue":"इक","resindex":0},"index":0}],"identifier":"do_112722087821852672124","consumerId":"9393568c-3a56-47dd-a9a3-34da3c821638","version":2,"versionKey":"1552989236064","lhs_options":[{"value":{"type":"mixed","text":"इक","image":"","count":"","audio":"","resvalue":"इक","resindex":0},"index":0}],"framework":"NCFCOPY","createdBy":"390","max_score":1,"name":"Test MTF\n","template_id":"NA","category":"MTF","board":"NCERT","status":"Live","$$hashKey":"object:2042"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}}; + var data1 = mtfData.data; + dataObj = { callback: undefined, data: data1}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance._questions[0].type).toEqual('mtf'); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + }); + + it('Media attribute missing v1 data', function(done) { + plugin.data = newData; + var v1NewData = {"data":{"data":[{"template":[{"org.ekstep.plugins.funtoot.genericitemrenderer":{"w":100,"h":100,"x":0,"y":0,"rotate":"","id":"44cce289-b407-4628-9900-8adbb67b2386"},"id":"funtoot.template.01"}],"itemType":"UNIT","code":"QFIB02230","keywords":["mcq"],"qtype":"mcq","subject":"Mathematics","qlevel":"MEDIUM","channel":"in.ekstep","language":["English"],"medium":"English","type":"mcq","title":"","qid":"QFIB02230","createdOn":"2018-02-01T06:55:09.970+0000","qindex":"","question_audio":"","gradeLevel":["Class 5"],"appId":"ekstep_portal","options":[{"value":{"type":"text","asset":"OPT_0","audio":"","count":null,"resvalue":0,"resindex":0},"answer":true,"mh":"MH_0","mmc":[]},{"value":{"type":"text","asset":"OPT_1","audio":"","count":null,"resvalue":1,"resindex":1},"answer":false,"mh":"MH_1","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_2","audio":"","count":null,"resvalue":2,"resindex":2},"answer":false,"mh":"MH_2","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_3","audio":"","count":null,"resvalue":3,"resindex":3},"answer":false,"mh":"MH_3","mmc":["FC130"]}],"lastUpdatedOn":"2019-02-19T09:26:05.444+0000","used_for":"worksheet","model":{"hintMsg":"HINT_ID","numericLangId":"en","langId":"en","variables":[],"mcqType":8},"state":"Verified","subLevel":"","identifier":"QFIB02230","question":"QUESTION_TEXT","level":2,"consumerId":"ec175d89-64b0-4e23-9f81-076e4d379a8f","author":"funtoot","portalOwner":"562","version":1,"i18n":"{\"en\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\",\"HINT_ID\":\"For addition of like fractions, add the numerators only. Denominator remains the same.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` equals to:\",\"MH_0\":\"\",\"MH_1\":\"Add the numerators of all the fractions correctly.\",\"MH_2\":\"Do not multiply the numerators. Add them.\",\"MH_3\":\"This is the reciprocal of the answer.\",\"NO_ANSWER\":\"Click the answer and then press the submit button\"},\"ta\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"HINT_ID\":\"ஒத்த பின்னங்களின் கூடுதலானது, தொகுதிகளின் கூடுதல் மட்டுமே.பகுதி மாறாது.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` =\",\"MH_0\":\"\",\"MH_1\":\"அனைத்து பின்னங்களின் தொகுதிகளை சரியாக கூட்டவும்\",\"MH_2\":\"தொகுதிகளை பெருக்காமல் கூட்டவும்\",\"MH_3\":\"இதுவே தலைகிழ் மதிப்பாகும்.\",\"NO_ANSWER\":\"தயவுசெய்து பதிலளிக்கவும்\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\\n\"}}","versionKey":"1550568365444","tags":["mcq"],"question_count":1,"framework":"NCF","answer":{},"grade":["5"],"domain":"Numeracy","max_score":5,"name":"QFIB02230","sublevel":1,"num_answers":1,"template_id":"do_2125053652669235201268","category":"MCQ","bloomsTaxonomyLevel":"Understand","status":"Live","isSelected":true,"$$hashKey":"object:2661","testmanifest":{"testmedia":[{"id":"9c9bc62c-cc13-4191-bbee-57ec2a4b1dca","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js","type":"js"},{"id":"7922b23d-7d68-4d20-a004-1ca223750316","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html","type":"js"},{"id":"org.ekstep.navigation","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.navigation_manifest","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/manifest.json","type":"json"},{"id":"polyglot","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/polyglot.js","type":"js"},{"id":"org.ekstep.plugins.i18n","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.i18n_manifest","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/manifest.json","type":"json"},{"id":"keyboardcss","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard.css","type":"css"},{"id":"org.ekstep.plugins.common.keyboard","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.common.keyboard_manifest","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/manifest.json","type":"json"},{"id":"generators","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/generators.js","type":"js"},{"id":"eraser","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/eraser.png","type":"image"},{"id":"seq","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/seq.png","type":"image"},{"id":"semitrans","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/semitrans.png","type":"image"},{"id":"zoom-in","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/zoom.png","type":"image"},{"id":"plus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/plus_white.png","type":"image"},{"id":"minus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/minus_white.png","type":"image"},{"id":"micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"micro-hint-mdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"html-micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"drop-down","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/drop-down-icon.png","type":"image"},{"id":"org.ekstep.funtoot.hint-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/hint.png","type":"image"},{"id":"org.ekstep.funtoot.solution-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/solimg.png","type":"image"},{"id":"close","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/close.png","type":"image"},{"id":"submit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/icn_submit.png","type":"image"},{"id":"undo","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/undo.png","type":"image"},{"id":"clearall","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/clearall.png","type":"image"},{"id":"disabledsubmit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/disabled_submit.png","type":"image"},{"id":"org.ekstep.funtoot.asset.next","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/next.png","type":"image"},{"id":"editable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/editable.png","type":"image"},{"id":"nonEditable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/noneditable.png","type":"image"},{"id":"additioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/additioneval.js","type":"js"},{"id":"fractioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fractioneval.js","type":"js"},{"id":"multiplicationeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/multiplicationeval.js","type":"js"},{"id":"divisioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/divisioneval.js","type":"js"},{"id":"clockcontrol","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/clockcontrol.js","type":"plugin"},{"id":"numberlineeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlineeval.js","type":"js"},{"id":"mathquill","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.js","type":"js"},{"id":"mathjs","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/math.min.js","type":"js"},{"id":"mathquill-basic","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.css","type":"css"},{"id":"genericmdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/genericmdd.css","type":"css"},{"id":"zoomableImageStyle","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/zoomableimage.css","type":"css"},{"id":"mathtext","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathtext.js","type":"plugin"},{"id":"mathedit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathedit.js","type":"plugin"},{"id":"org.ekstep.funtoot.ftPlugin","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbaseplugin.js","type":"plugin"},{"id":"nkeyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/customnumkeyboard.js","type":"plugin"},{"id":"keyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"fibblankprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fibblankprocessor.js","type":"plugin"},{"id":"ftbdropdownprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbdropdownprocessor.js","type":"plugin"},{"id":"org.ekstep.funtoot.zoomableImage","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/zoomableimage.js","type":"plugin"},{"id":"defaultkeyboardadapter","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/defaultkeyboardadapter.js","type":"plugin"},{"id":"ftFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfib.js","type":"plugin"},{"id":"ftPluginHelper","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpluginhelper.js","type":"plugin"},{"id":"org.ekstep.funtoot.grid","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/grid.js","type":"plugin"},{"id":"org.ekstep.funtoot.table","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/table.js","type":"plugin"},{"id":"keyboard_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/numerickeyboard.css","type":"css"},{"id":"htmlpopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/htmlpopupplugin.js","type":"plugin"},{"id":"htmlpopup_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/htmlpopup.css","type":"css"},{"id":"htmlpopup_js","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/scripts/htmlpopup.js","type":"js"},{"id":"ftMicroHint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftmicrohint.js","type":"plugin"},{"id":"ftPopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpopup.js","type":"plugin"},{"id":"ftAttempts","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftattempts.js","type":"plugin"},{"id":"inlineFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/inlinefib.js","type":"plugin"},{"id":"numberlinenumber","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlinenumber.js","type":"plugin"},{"id":"numberline","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberline.js","type":"plugin"},{"id":"org.ekstep.funtoot.option","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/option.js","type":"plugin"},{"id":"org.ekstep.funtoot.optionBuilder","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/optionbuilder.js","type":"plugin"},{"id":"org.ekstep.funtoot.common","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfibbaseplugin.js","type":"plugin"},{"id":"org.ekstep.funtoot.common_manifest","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/renderer/fibwordproblem.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem_manifest","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericfib","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericfib_manifest","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmfr","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmfr_manifest","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmdd","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmdd_manifest","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmcq","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmcq_manifest","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/manifest.json","type":"json"},{"id":"connector","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/asset/connector.png","type":"image"},{"id":"org.ekstep.plugins.funtoot.genericmtf","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmtf_manifest","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericseq","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericseq_manifest","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer_manifest","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/manifest.json","type":"json"}]}}],"config":{"title":"test","max_score":5,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}} + data1 = v1NewData.data; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance.media.QuizImage).toBeTruthy(); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + }); + + it('Media attribute missing v2 data', function(done) { + var v2NewData = {"data":[{"template":"NA","templateType":"Horizontal","itemType":"UNIT","isPartialScore":true,"code":"NA","subject":"domain","qlevel":"MEDIUM","evalUnordered":false,"channel":"0126089810590679040","language":["English"],"title":"gg dfgdfgdfg\n","type":"mcq","body":"{\"media\":[],\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.1\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"

gg dfgdfgdfg

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"

g

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:787\"},{\"text\":\"

t

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:788\"}],\"questionCount\":0,\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"gg dfgdfgdfg\\n\",\"title\":\"gg dfgdfgdfg\\n\",\"category\":\"MCQ\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-02-19T09:37:39.559+0000","isShuffleOption":false,"appId":"qa.Upgrade-lms.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-02-19T09:37:39.559+0000","identifier":"do_21270226173590732811047","consumerId":"298450cb-c202-45f0-adee-9224c7612f35","version":2,"versionKey":"1550569059559","framework":"jdf1","createdBy":"4f0656c1-df55-4e27-911c-cb79fc1bd611","max_score":1,"name":"gg dfgdfgdfg\n","template_id":"NA","category":"MCQ","status":"Live","isSelected":true,"$$hashKey":"object:1985"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}; + data1 = v2NewData.data; + var callback = {data: v2NewData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + expect(instance.media.QuizImage).toBeTruthy(); + expect(instance.manifest.id).toEqual('org.ekstep.questionset'); + done(); + }, 500); + + }); + + + it('should call getPropsForEditor', function(done) { + plugin.data = newData; + plugin.newInstance(); + setTimeout(function _expect(){ + expect(plugin.getPropsForEditor).toHaveBeenCalled(); + done(); + }, 400); + }); + + it('should add an image representing question set as editorObj', function(done) { + fabricGroup = {"type":"group","originX":"left","originY":"top","left":72,"top":12.15,"width":785,"height":513,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":0.71,"scaleY":0.71,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"objects":[{"type":"image","originX":"left","originY":"top","left":-392.5,"top":-256.5,"width":785,"height":513,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"src":"http://localhost:9876/base/org.ekstep.questionset-1.0/editor/assets/quizimage.png","filters":[],"resizeFilters":[]},{"type":"group","originX":"left","originY":"top","left":-359.5,"top":-235.65,"width":125.66,"height":31.56,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"objects":[{"type":"text","originX":"left","originY":"top","left":-62.83,"top":-15.78,"width":35.83,"height":16.95,"fill":"black","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0},{"type":"text","originX":"left","originY":"top","left":-62.83,"top":1.22,"width":72.33,"height":13.56,"fill":"black","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0},{"type":"text","originX":"left","originY":"top","left":22.17,"top":1.22,"width":39.66,"height":13.56,"fill":"black","stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0}]}]}; + plugin.data = newData; + plugin.newInstance(); + setTimeout(function _expect(){ + expect(JSON.stringify(plugin.editorObj)).toEqual(JSON.stringify(fabricGroup)); + done(); + }, 600); + + }); + + }); + + + + describe("to ECML", function() { + + it('should call createEcmlStructureV1', function() { + var data1 = {"data":[{"template":"NA","templateType":"Horizontal","itemType":"UNIT","isPartialScore":true,"code":"NA","subject":"domain","qlevel":"MEDIUM","evalUnordered":false,"channel":"0126089810590679040","language":["English"],"title":"gg dfgdfgdfg\n","type":"mcq","body":"{\"data\":{\"plugin\":{\"id\":\"org.ekstep.questionunit.mcq\",\"version\":\"1.1\",\"templateId\":\"horizontalMCQ\"},\"data\":{\"question\":{\"text\":\"

gg dfgdfgdfg

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"

g

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:787\"},{\"text\":\"

t

\\n\",\"image\":\"\",\"audio\":\"\",\"audioName\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:788\"}],\"questionCount\":0,\"media\":[]},\"config\":{\"metadata\":{\"max_score\":1,\"isShuffleOption\":false,\"isPartialScore\":true,\"evalUnordered\":false,\"templateType\":\"Horizontal\",\"name\":\"gg dfgdfgdfg\\n\",\"title\":\"gg dfgdfgdfg\\n\",\"category\":\"MCQ\"},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false,\"questionCount\":1,\"evalUnordered\":false},\"media\":[]}}","createdOn":"2019-02-19T09:37:39.559+0000","isShuffleOption":false,"appId":"qa.Upgrade-lms.portal","options":[{"answer":true,"value":{"type":"text","asset":"1","resvalue":0,"resindex":0}}],"lastUpdatedOn":"2019-02-19T09:37:39.559+0000","identifier":"do_21270226173590732811047","consumerId":"298450cb-c202-45f0-adee-9224c7612f35","version":2,"versionKey":"1550569059559","framework":"jdf1","createdBy":"4f0656c1-df55-4e27-911c-cb79fc1bd611","max_score":1,"name":"gg dfgdfgdfg\n","template_id":"NA","category":"MCQ","status":"Live","isSelected":true,"$$hashKey":"object:1985"}],"config":{"title":"test","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}}; + var data2 = {"data":[{"template":[{"org.ekstep.plugins.funtoot.genericitemrenderer":{"w":100,"h":100,"x":0,"y":0,"rotate":"","id":"44cce289-b407-4628-9900-8adbb67b2386"},"id":"funtoot.template.01"}],"itemType":"UNIT","code":"QFIB02230","keywords":["mcq"],"qtype":"mcq","subject":"Mathematics","qlevel":"MEDIUM","channel":"in.ekstep","language":["English"],"medium":"English","type":"mcq","title":"","qid":"QFIB02230","createdOn":"2018-02-01T06:55:09.970+0000","qindex":"","question_audio":"","gradeLevel":["Class 5"],"appId":"ekstep_portal","options":[{"value":{"type":"text","asset":"OPT_0","audio":"","count":null,"resvalue":0,"resindex":0},"answer":true,"mh":"MH_0","mmc":[]},{"value":{"type":"text","asset":"OPT_1","audio":"","count":null,"resvalue":1,"resindex":1},"answer":false,"mh":"MH_1","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_2","audio":"","count":null,"resvalue":2,"resindex":2},"answer":false,"mh":"MH_2","mmc":["FC090"]},{"value":{"type":"text","asset":"OPT_3","audio":"","count":null,"resvalue":3,"resindex":3},"answer":false,"mh":"MH_3","mmc":["FC130"]}],"lastUpdatedOn":"2019-02-19T09:26:05.444+0000","used_for":"worksheet","model":{"hintMsg":"HINT_ID","numericLangId":"en","langId":"en","variables":[],"mcqType":8},"state":"Verified","subLevel":"","identifier":"QFIB02230","question":"QUESTION_TEXT","level":2,"consumerId":"ec175d89-64b0-4e23-9f81-076e4d379a8f","author":"funtoot","portalOwner":"562","version":1,"i18n":"{\"en\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\",\"HINT_ID\":\"For addition of like fractions, add the numerators only. Denominator remains the same.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` equals to:\",\"MH_0\":\"\",\"MH_1\":\"Add the numerators of all the fractions correctly.\",\"MH_2\":\"Do not multiply the numerators. Add them.\",\"MH_3\":\"This is the reciprocal of the answer.\",\"NO_ANSWER\":\"Click the answer and then press the submit button\"},\"ta\":{\"OPT_3\":\"``\\\\frac{$d1}{$n4}``\",\"OPT_2\":\"``\\\\frac{$n6}{$d1}``\",\"OPT_1\":\"``\\\\frac{$n5}{$d1}``\",\"OPT_0\":\"``\\\\frac{$n4}{$d1}``\",\"HINT_ID\":\"ஒத்த பின்னங்களின் கூடுதலானது, தொகுதிகளின் கூடுதல் மட்டுமே.பகுதி மாறாது.\",\"QUESTION_TEXT\":\"``\\\\frac{$n1}{$d1}``+ ``\\\\frac{$n2}{$d1}``+ ``\\\\frac{$n3}{$d1}`` =\",\"MH_0\":\"\",\"MH_1\":\"அனைத்து பின்னங்களின் தொகுதிகளை சரியாக கூட்டவும்\",\"MH_2\":\"தொகுதிகளை பெருக்காமல் கூட்டவும்\",\"MH_3\":\"இதுவே தலைகிழ் மதிப்பாகும்.\",\"NO_ANSWER\":\"தயவுசெய்து பதிலளிக்கவும்\",\"EXPRESSIONS\":\"$n1=random(1,2)\\n$n2=random(3,4)\\n$n3=random(4,5)\\n$d1=random([23,31])\\n$n4=$n1+$n2+$n3\\n$n5=$n1+$n2\\n$n6=$n1*$n2*$n3\\n\"}}","versionKey":"1550568365444","tags":["mcq"],"question_count":1,"framework":"NCF","answer":{},"grade":["5"],"domain":"Numeracy","max_score":5,"name":"QFIB02230","sublevel":1,"num_answers":1,"template_id":"do_2125053652669235201268","category":"MCQ","bloomsTaxonomyLevel":"Understand","status":"Live","isSelected":true,"$$hashKey":"object:2594","mediamanifest":{"media":[{"id":"9c9bc62c-cc13-4191-bbee-57ec2a4b1dca","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/controller/navigation_ctrl.js","type":"js"},{"id":"7922b23d-7d68-4d20-a004-1ca223750316","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/templates/navigation.html","type":"js"},{"id":"org.ekstep.navigation","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.navigation_manifest","plugin":"org.ekstep.navigation","ver":1,"src":"/content-plugins/org.ekstep.navigation-1.0/manifest.json","type":"json"},{"id":"polyglot","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/polyglot.js","type":"js"},{"id":"org.ekstep.plugins.i18n","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.i18n_manifest","plugin":"org.ekstep.plugins.i18n","ver":1,"src":"/content-plugins/org.ekstep.plugins.i18n-1.0/manifest.json","type":"json"},{"id":"keyboardcss","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard.css","type":"css"},{"id":"org.ekstep.plugins.common.keyboard","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.common.keyboard_manifest","plugin":"org.ekstep.plugins.common.keyboard","ver":1,"src":"/content-plugins/org.ekstep.plugins.common.keyboard-1.0/manifest.json","type":"json"},{"id":"generators","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/generators.js","type":"js"},{"id":"eraser","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/eraser.png","type":"image"},{"id":"seq","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/seq.png","type":"image"},{"id":"semitrans","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/semitrans.png","type":"image"},{"id":"zoom-in","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/zoom.png","type":"image"},{"id":"plus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/plus_white.png","type":"image"},{"id":"minus-white","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/minus_white.png","type":"image"},{"id":"micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"micro-hint-mdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"html-micro-hint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/micro-hint.png","type":"image"},{"id":"drop-down","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/drop-down-icon.png","type":"image"},{"id":"org.ekstep.funtoot.hint-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/hint.png","type":"image"},{"id":"org.ekstep.funtoot.solution-icon","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/solimg.png","type":"image"},{"id":"close","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/close.png","type":"image"},{"id":"submit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/icn_submit.png","type":"image"},{"id":"undo","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/undo.png","type":"image"},{"id":"clearall","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/clearall.png","type":"image"},{"id":"disabledsubmit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/disabled_submit.png","type":"image"},{"id":"org.ekstep.funtoot.asset.next","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/next.png","type":"image"},{"id":"editable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/editable.png","type":"image"},{"id":"nonEditable","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/assets/noneditable.png","type":"image"},{"id":"additioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/additioneval.js","type":"js"},{"id":"fractioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fractioneval.js","type":"js"},{"id":"multiplicationeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/multiplicationeval.js","type":"js"},{"id":"divisioneval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/divisioneval.js","type":"js"},{"id":"clockcontrol","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/clockcontrol.js","type":"plugin"},{"id":"numberlineeval","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlineeval.js","type":"js"},{"id":"mathquill","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.js","type":"js"},{"id":"mathjs","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/math.min.js","type":"js"},{"id":"mathquill-basic","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathquill.css","type":"css"},{"id":"genericmdd","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/genericmdd.css","type":"css"},{"id":"zoomableImageStyle","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/zoomableimage.css","type":"css"},{"id":"mathtext","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathtext.js","type":"plugin"},{"id":"mathedit","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/mathedit.js","type":"plugin"},{"id":"org.ekstep.funtoot.ftPlugin","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbaseplugin.js","type":"plugin"},{"id":"nkeyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/customnumkeyboard.js","type":"plugin"},{"id":"keyboard","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/keyboard-plugin.js","type":"plugin"},{"id":"fibblankprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/fibblankprocessor.js","type":"plugin"},{"id":"ftbdropdownprocessor","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftbdropdownprocessor.js","type":"plugin"},{"id":"org.ekstep.funtoot.zoomableImage","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/zoomableimage.js","type":"plugin"},{"id":"defaultkeyboardadapter","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/defaultkeyboardadapter.js","type":"plugin"},{"id":"ftFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfib.js","type":"plugin"},{"id":"ftPluginHelper","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpluginhelper.js","type":"plugin"},{"id":"org.ekstep.funtoot.grid","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/grid.js","type":"plugin"},{"id":"org.ekstep.funtoot.table","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/table.js","type":"plugin"},{"id":"keyboard_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/numerickeyboard.css","type":"css"},{"id":"htmlpopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/htmlpopupplugin.js","type":"plugin"},{"id":"htmlpopup_css","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/css/htmlpopup.css","type":"css"},{"id":"htmlpopup_js","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/scripts/htmlpopup.js","type":"js"},{"id":"ftMicroHint","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftmicrohint.js","type":"plugin"},{"id":"ftPopup","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftpopup.js","type":"plugin"},{"id":"ftAttempts","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftattempts.js","type":"plugin"},{"id":"inlineFib","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/inlinefib.js","type":"plugin"},{"id":"numberlinenumber","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberlinenumber.js","type":"plugin"},{"id":"numberline","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/numberline.js","type":"plugin"},{"id":"org.ekstep.funtoot.option","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/option.js","type":"plugin"},{"id":"org.ekstep.funtoot.optionBuilder","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/optionbuilder.js","type":"plugin"},{"id":"org.ekstep.funtoot.common","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/renderer/ftfibbaseplugin.js","type":"plugin"},{"id":"org.ekstep.funtoot.common_manifest","plugin":"org.ekstep.funtoot.common","ver":1,"src":"/content-plugins/org.ekstep.funtoot.common-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/renderer/fibwordproblem.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.fibwordproblem_manifest","plugin":"org.ekstep.plugins.funtoot.fibwordproblem","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.fibwordproblem-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericfib","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericfib_manifest","plugin":"org.ekstep.plugins.funtoot.genericfib","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericfib-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmfr","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmfr_manifest","plugin":"org.ekstep.plugins.funtoot.genericmfr","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmfr-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmdd","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmdd_manifest","plugin":"org.ekstep.plugins.funtoot.genericmdd","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmdd-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericmcq","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmcq_manifest","plugin":"org.ekstep.plugins.funtoot.genericmcq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmcq-1.0/manifest.json","type":"json"},{"id":"connector","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/asset/connector.png","type":"image"},{"id":"org.ekstep.plugins.funtoot.genericmtf","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericmtf_manifest","plugin":"org.ekstep.plugins.funtoot.genericmtf","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericmtf-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericseq","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericseq_manifest","plugin":"org.ekstep.plugins.funtoot.genericseq","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericseq-1.0/manifest.json","type":"json"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/renderer/plugin.js","type":"plugin"},{"id":"org.ekstep.plugins.funtoot.genericitemrenderer_manifest","plugin":"org.ekstep.plugins.funtoot.genericitemrenderer","ver":1,"src":"/content-plugins/org.ekstep.plugins.funtoot.genericitemrenderer-1.0/manifest.json","type":"json"}]}}],"config":{"title":"test2","max_score":5,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":1}} + var allQuestions = data1.data.concat(data2.data); + plugin.data = allQuestions; + plugin.toECML(); + expect(plugin.createEcmlStructureV1).toHaveBeenCalled(); + }); + + it('should not call createEcmlStructureV1 if it is v2 question', function() { + plugin.data = v2Data; + plugin.toECML(); + expect(plugin.createEcmlStructureV1).not.toHaveBeenCalled(); + }); + + it('should return ecml of question set v1', function() { + plugin.data = v1Data; + var v1ecml = plugin.toECML(); + var expectedEcml = { "x": 9, "y": 6, "w": 80, "h": 85, "rotate": 0, "z-index": 0, "id": "a46c31a7-9abc-4852-980e-0ea6003642de", "data": { "__cdata": "[{\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"h\":15,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":24,\"x\":0,\"y\":10,\"type\":\"rect\"},\"g\":[{\"placeholder\":[{\"model-count\":\"item.optionCount1\",\"w\":30,\"h\":100,\"x\":0,\"y\":0,\"valign\":\"middle\",\"align\":\"center\",\"type\":\"gridLayout\",\"model-asset\":\"item.question_image\"},{\"model-count\":\"item.optionCount2\",\"w\":30,\"h\":100,\"x\":40,\"y\":0,\"valign\":\"middle\",\"align\":\"center\",\"type\":\"gridLayout\",\"model-asset\":\"item.question_image\"}],\"text\":[{\"color\":\"#4c4c4c\",\"w\":5,\"h\":0,\"x\":32,\"fontsize\":\"3vw\",\"y\":55,\"model\":\"item.operator1\",\"valign\":\"middle\",\"align\":\"center\"},{\"color\":\"#4c4c4c\",\"w\":5,\"h\":0,\"x\":72,\"fontsize\":\"3vw\",\"y\":55,\"model\":\"item.operator2\",\"valign\":\"middle\",\"align\":\"center\"},{\"z-index\":30,\"color\":\"#4c4c4c\",\"w\":20,\"h\":40,\"x\":80,\"fontsize\":\"3vw\",\"y\":38,\"model\":\"item.ans1\",\"valign\":\"middle\",\"id\":\"newText1\",\"align\":\"center\"}],\"g\":{\"shape\":{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"stroke-width\":3,\"fill\":\"#FFFFA5\",\"type\":\"roundrect\",\"stroke\":\"#719ECE\"},\"z-index\":20,\"w\":20,\"h\":40,\"x\":80,\"y\":34,\"id\":\"textshape1\"},\"w\":100,\"h\":32,\"x\":0,\"y\":33},{\"nkeyboard\":{\"keys\":\"item.keys\",\"w\":100,\"h\":25,\"limit\":7,\"x\":0,\"y\":82,\"id\":\"bKeyboard\",\"type\":\"custom\",\"target\":\"newText1\"},\"w\":100,\"h\":100,\"x\":0,\"y\":0}],\"id\":\"Operations_with_images\"}],\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5abb516b8f224\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"media\":[{\"id\":\"do_11246090113921843213\",\"type\":\"image\",\"src\":\"https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg\",\"asset_id\":\"do_11246090113921843213\"}],\"type\":\"ftb\",\"title\":\"v1 - operations with images\",\"createdOn\":\"2018-03-28T08:25:15.611+0000\",\"gradeLevel\":[\"Kindergarten\"],\"appId\":\"ekstep_portal\",\"question_image\":\"do_11246090113921843213\",\"lastUpdatedOn\":\"2018-03-28T08:25:15.611+0000\",\"used_for\":\"worksheet\",\"model\":{\"optionCount1\":\"4\",\"optionCount2\":\"3\",\"operator1\":\"-\",\"operator2\":\"=\",\"keys\":\"0,1,2,3,4,5,6,7,8,9,+,-,×,÷,=,<,>,/,.\"},\"lastUpdatedBy\":\"597\",\"identifier\":\"do_112470071423893504143\",\"question\":\"v1 - operations with images\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522225515611\",\"answer\":{\"ans1\":{\"value\":\"1\",\"score\":1}},\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":1,\"domain\":[\"literacy\"],\"name\":\"v1 - operations with images\",\"template_id\":\"do_112470023566245888128\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:694\",\"mediamanifest\":{\"media\":[{\"id\":\"do_11246090113921843213\",\"type\":\"image\",\"src\":\"https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg\",\"asset_id\":\"do_11246090113921843213\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_112470023566245888128/assets/1522219674003/customnumkeyboard.js\",\"id\":\"nkeyboard\",\"type\":\"plugin\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_112470023566245888128/assets/1522219674010/numerickeyboard.css\",\"id\":\"keyboard_css\",\"type\":\"css\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"}]}}]" }, "config": { "__cdata": "{\"title\":\"qs\",\"max_score\":1,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"}" }, "org.ekstep.question": [{ "id": "771329d0-21d4-4834-96ac-de16576241e6", "type": "ftb", "pluginId": "org.ekstep.questionset.quiz", "pluginVer": "1.0", "templateId": "horizontalMCQ", "data": { "__cdata": "{\"questionnaire\":{\"items\":{\"do_112470071423893504143\":[{\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5abb516b8f224\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"media\":[{\"id\":\"do_11246090113921843213\",\"type\":\"image\",\"src\":\"https://dev.ekstep.in/assets/public/content/do_11246090113921843213/artifact/ae36d87ad0aa9438984018205a9c0fa0_1521106096238.jpeg\",\"asset_id\":\"do_11246090113921843213\"}],\"type\":\"ftb\",\"title\":\"v1 - operations with images\",\"createdOn\":\"2018-03-28T08:25:15.611+0000\",\"gradeLevel\":[\"Kindergarten\"],\"appId\":\"ekstep_portal\",\"question_image\":\"do_11246090113921843213\",\"lastUpdatedOn\":\"2018-03-28T08:25:15.611+0000\",\"used_for\":\"worksheet\",\"model\":{\"optionCount1\":\"4\",\"optionCount2\":\"3\",\"operator1\":\"-\",\"operator2\":\"=\",\"keys\":\"0,1,2,3,4,5,6,7,8,9,+,-,×,÷,=,<,>,/,.\"},\"lastUpdatedBy\":\"597\",\"identifier\":\"do_112470071423893504143\",\"question\":\"v1 - operations with images\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522225515611\",\"answer\":{\"ans1\":{\"value\":\"1\",\"score\":1}},\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":1,\"domain\":[\"literacy\"],\"name\":\"v1 - operations with images\",\"template_id\":\"do_112470023566245888128\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:694\",\"template\":\"Operations_with_images\"}]},\"item_sets\":[{\"count\":1,\"id\":\"do_112470071423893504143\"}],\"title\":\"qs\",\"max_score\":1,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"},\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"h\":15,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":24,\"x\":0,\"y\":10,\"type\":\"rect\"},\"g\":[{\"placeholder\":[{\"model-count\":\"item.optionCount1\",\"w\":30,\"h\":100,\"x\":0,\"y\":0,\"valign\":\"middle\",\"align\":\"center\",\"type\":\"gridLayout\",\"model-asset\":\"item.question_image\"},{\"model-count\":\"item.optionCount2\",\"w\":30,\"h\":100,\"x\":40,\"y\":0,\"valign\":\"middle\",\"align\":\"center\",\"type\":\"gridLayout\",\"model-asset\":\"item.question_image\"}],\"text\":[{\"color\":\"#4c4c4c\",\"w\":5,\"h\":0,\"x\":32,\"fontsize\":\"3vw\",\"y\":55,\"model\":\"item.operator1\",\"valign\":\"middle\",\"align\":\"center\"},{\"color\":\"#4c4c4c\",\"w\":5,\"h\":0,\"x\":72,\"fontsize\":\"3vw\",\"y\":55,\"model\":\"item.operator2\",\"valign\":\"middle\",\"align\":\"center\"},{\"z-index\":30,\"color\":\"#4c4c4c\",\"w\":20,\"h\":40,\"x\":80,\"fontsize\":\"3vw\",\"y\":38,\"model\":\"item.ans1\",\"valign\":\"middle\",\"id\":\"newText1\",\"align\":\"center\"}],\"g\":{\"shape\":{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"stroke-width\":3,\"fill\":\"#FFFFA5\",\"type\":\"roundrect\",\"stroke\":\"#719ECE\"},\"z-index\":20,\"w\":20,\"h\":40,\"x\":80,\"y\":34,\"id\":\"textshape1\"},\"w\":100,\"h\":32,\"x\":0,\"y\":33},{\"nkeyboard\":{\"keys\":\"item.keys\",\"w\":100,\"h\":25,\"limit\":7,\"x\":0,\"y\":82,\"id\":\"bKeyboard\",\"type\":\"custom\",\"target\":\"newText1\"},\"w\":100,\"h\":100,\"x\":0,\"y\":0}],\"id\":\"Operations_with_images\"}]}" }, "config": { "__cdata": "{\"type\":\"items\",\"var\":\"item\"}" }, "w": 80, "h": 85, "x": 9, "y": 6 }] }; + expect(v1ecml[org.ekstep.question]).toEqual(expectedEcml[org.ekstep.question]); + }); + it('should return ecml of question set v2', function() { + plugin.data = v2Data; + var v2ecml = plugin.toECML(); + var expectedEcml = { "x": 9, "y": 6, "w": 80, "h": 85, "rotate": 0, "z-index": 0, "id": "1a5d8740-ea06-4975-828e-5ad9703be942", "data": { "__cdata": "[{\"template\":\"NA\",\"itemType\":\"UNIT\",\"code\":\"NA\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"test\",\"language\":[\"English\"],\"type\":\"mcq\",\"title\":\"test image and audio for the image\",\"body\":\"{\\\"data\\\":{\\\"plugin\\\":{\\\"id\\\":\\\"org.ekstep.questionunit.mcq\\\",\\\"version\\\":\\\"1.0\\\",\\\"templateId\\\":\\\"horizontalMCQ\\\"},\\\"data\\\":{\\\"question\\\":{\\\"text\\\":\\\"test image and audio for the image\\\",\\\"image\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"audio\\\":\\\"\\\",\\\"hint\\\":\\\"\\\"},\\\"options\\\":[{\\\"text\\\":\\\"test1\\\",\\\"image\\\":\\\"\\\",\\\"audio\\\":\\\"/assets/public/content/145503359952511.mp3\\\",\\\"hint\\\":\\\"\\\",\\\"isCorrect\\\":true,\\\"$$hashKey\\\":\\\"object:3278\\\"},{\\\"text\\\":\\\"test2\\\",\\\"image\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"audio\\\":\\\"\\\",\\\"hint\\\":\\\"\\\",\\\"isCorrect\\\":false,\\\"$$hashKey\\\":\\\"object:3279\\\"}],\\\"media\\\":[{\\\"id\\\":566752436,\\\"src\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"assetId\\\":\\\"do_20072814\\\",\\\"type\\\":\\\"image\\\",\\\"preload\\\":false},{\\\"id\\\":576331075,\\\"src\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"assetId\\\":\\\"do_20072814\\\",\\\"type\\\":\\\"image\\\",\\\"preload\\\":false},{\\\"id\\\":94711675,\\\"src\\\":\\\"/assets/public/content/145503359952511.mp3\\\",\\\"assetId\\\":\\\"11_sound\\\",\\\"type\\\":\\\"audio\\\",\\\"preload\\\":false}]},\\\"config\\\":{\\\"metadata\\\":{\\\"category\\\":\\\"MCQ\\\",\\\"title\\\":\\\"test image and audio for the image\\\",\\\"language\\\":[\\\"English\\\"],\\\"qlevel\\\":\\\"EASY\\\",\\\"gradeLevel\\\":[\\\"Kindergarten\\\"],\\\"concepts\\\":[\\\"BIO3\\\"],\\\"description\\\":\\\"test\\\",\\\"max_score\\\":1},\\\"max_time\\\":0,\\\"max_score\\\":1,\\\"partial_scoring\\\":false,\\\"layout\\\":\\\"Horizontal\\\",\\\"isShuffleOption\\\":false},\\\"media\\\":[{\\\"id\\\":566752436,\\\"src\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"assetId\\\":\\\"do_20072814\\\",\\\"type\\\":\\\"image\\\",\\\"preload\\\":false},{\\\"id\\\":576331075,\\\"src\\\":\\\"/assets/public/content/2_1466487176189.jpg\\\",\\\"assetId\\\":\\\"do_20072814\\\",\\\"type\\\":\\\"image\\\",\\\"preload\\\":false},{\\\"id\\\":94711675,\\\"src\\\":\\\"/assets/public/content/145503359952511.mp3\\\",\\\"assetId\\\":\\\"11_sound\\\",\\\"type\\\":\\\"audio\\\",\\\"preload\\\":false}]}}\",\"createdOn\":\"2018-03-23T10:15:24.824+0000\",\"gradeLevel\":[\"Grade 1\"],\"appId\":\"ekstep_portal\",\"options\":[{\"answer\":true,\"value\":{\"type\":\"text\",\"asset\":\"1\",\"resvalue\":0,\"resindex\":0}}],\"lastUpdatedOn\":\"2018-03-23T10:15:24.824+0000\",\"identifier\":\"do_112466586622558208121\",\"question\":\"test image and audio for the image\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":2,\"versionKey\":\"1521800124824\",\"createdBy\":\"580\",\"max_score\":1,\"name\":\"test image and audio for the image\",\"template_id\":\"NA\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1652\"}]" }, "config": { "__cdata": "{\"title\":\"qs\",\"max_score\":1,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"}" }, "org.ekstep.question": [{ "id": "d5298a2e-56e8-48d7-88b9-48ce7b8a7122", "type": "mcq", "pluginId": "org.ekstep.questionunit.mcq", "pluginVer": "1.0", "templateId": "horizontalMCQ", "data": { "__cdata": "{\"question\":{\"text\":\"test image and audio for the image\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\"},\"options\":[{\"text\":\"test1\",\"image\":\"\",\"audio\":\"/assets/public/content/145503359952511.mp3\",\"hint\":\"\",\"isCorrect\":true,\"$$hashKey\":\"object:3278\"},{\"text\":\"test2\",\"image\":\"/assets/public/content/2_1466487176189.jpg\",\"audio\":\"\",\"hint\":\"\",\"isCorrect\":false,\"$$hashKey\":\"object:3279\"}],\"media\":[{\"id\":566752436,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":576331075,\"src\":\"/assets/public/content/2_1466487176189.jpg\",\"assetId\":\"do_20072814\",\"type\":\"image\",\"preload\":false},{\"id\":94711675,\"src\":\"/assets/public/content/145503359952511.mp3\",\"assetId\":\"11_sound\",\"type\":\"audio\",\"preload\":false}]}" }, "config": { "__cdata": "{\"metadata\":{\"category\":\"MCQ\",\"title\":\"test image and audio for the image\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Kindergarten\"],\"concepts\":[\"BIO3\"],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":false,\"layout\":\"Horizontal\",\"isShuffleOption\":false}" }, "w": 80, "h": 85, "x": 9, "y": 6 }] }; + expect(v2ecml[org.ekstep.question]).toEqual(expectedEcml[org.ekstep.question]); + }); + it('should call add media 3 times for v2Data', function() { + plugin.data = v2Data; + plugin.toECML(); + + expect(plugin.addMedia.calls.count()).toBe(3); + }); + }); + + describe("createEcmlStructureV1", function() { + + beforeEach(function() { + plugin.data = v1Data; + }); + + it('should call createEcmlStructureV1', function() { + var controller = {}; + controller = plugin.createEcmlStructureV1(plugin.data[0]); + expect(controller).toContain("questionnaire"); + expect(controller).toContain("template"); + expect(controller).toEqual(JSON.stringify(v1DataQuestion)); + }); + + }); + + describe('get config', function() { + + it('should return config object', function() { + var result = plugin.getConfig(); + var actualProps = Object.keys(result); + var expectedProps = ["title", "max_score", "allow_skip", "show_feedback", "shuffle_questions", "shuffle_options", "total_items", "btn_edit"]; + expect(actualProps).toEqual(expectedProps); + }); + + }); + + describe('openQuestionBank function', function() { + var event, callback, data; + + it('should open question bank popup when creating question set', function() { + event = { "target": undefined, "type": "org.ekstep.questionset:showPopup" }; + callback = undefined; + data = undefined; + plugin.openQuestionBank(event, callback); + expect(ecEditor.dispatchEvent).toHaveBeenCalledWith('org.ekstep.questionbank:showpopup', { callback: callback, data: data }); + }); + + it('should open question bank popup when editing question set', function(done) { + plugin.data = newData; + data1 = {"data":plugin.data,"config":plugin.config}; + var callback = {data: data1, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + event = { "target": undefined, "type": "org.ekstep.questionset:showPopup" }; + callback = { "type": "questionset", "callback": function() {} }; + data = { data: plugin.data, config: plugin.config }; + instance.openQuestionBank(event, callback); + expect(ecEditor.dispatchEvent).toHaveBeenCalledWith('org.ekstep.questionbank:showpopup', { callback: callback.callback, data: data }); + done(); + }, 500); + }); + + }); + + describe('on config change in sidebar', function() { + beforeEach(function() { + plugin.data = v2Data1; + plugin.editorObj = { "_objects": [{ "type": "image", "originX": "left", "originY": "top", "left": -392.5, "top": -256.5, "width": 785, "height": 513, "fill": "rgb(0,0,0)", "stroke": null, "strokeWidth": 0, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "clipTo": null, "backgroundColor": "", "fillRule": "nonzero", "globalCompositeOperation": "source-over", "transformMatrix": null, "skewX": 0, "skewY": 0, "src": "http://localhost:3000/plugins/org.ekstep.questionset-1.0/editor/assets/quizimage.png", "filters": [], "resizeFilters": [] }, { "type": "group", "originX": "left", "originY": "top", "left": -359.5, "top": -235.65, "width": 125.66, "height": 31.56, "fill": "rgb(0,0,0)", "stroke": null, "strokeWidth": 0, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "clipTo": null, "backgroundColor": "", "fillRule": "nonzero", "globalCompositeOperation": "source-over", "transformMatrix": null, "skewX": 0, "skewY": 0, "_objects": [{ "type": "text", "originX": "left", "originY": "top", "left": -62.83, "top": -15.78, "width": 10.83, "height": 16.95, "fill": "black", "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "clipTo": null, "backgroundColor": "", "fillRule": "nonzero", "globalCompositeOperation": "source-over", "transformMatrix": null, "skewX": 0, "skewY": 0 }, { "type": "text", "originX": "left", "originY": "top", "left": -62.83, "top": 1.22, "width": 72.33, "height": 13.56, "fill": "black", "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "clipTo": null, "backgroundColor": "", "fillRule": "nonzero", "globalCompositeOperation": "source-over", "transformMatrix": null, "skewX": 0, "skewY": 0 }, { "type": "text", "originX": "left", "originY": "top", "left": 22.17, "top": 1.22, "width": 39.66, "height": 13.56, "fill": "black", "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeLineJoin": "miter", "strokeMiterLimit": 10, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "clipTo": null, "backgroundColor": "", "fillRule": "nonzero", "globalCompositeOperation": "source-over", "transformMatrix": null, "skewX": 0, "skewY": 0 }] }] }; + }); + + it('should set question title to question set', function() { + plugin.editorObj._objects[1]._objects[0].setText = jasmine.createSpy('setText'); + plugin.onConfigChange("title", "question set"); + expect(plugin.config.title).toEqual("question set"); + }); + it('should set total_items to 2', function() { + plugin.editorObj._objects[1]._objects[1].setText = jasmine.createSpy('setText'); + plugin.onConfigChange("total_items", 2); + expect(plugin.config.total_items).toEqual(2); + }); + it('should set max_score to 2', function() { + plugin.editorObj._objects[1]._objects[2].setText = jasmine.createSpy('setText'); + plugin.onConfigChange("max_score", 2); + expect(plugin.config.max_score).toEqual(2); + }); + it('should call render', function() { + plugin.onConfigChange("shuffle_questions", false); + expect(ecEditor.render).toHaveBeenCalled(); + }); + it('should set shuffle_questions to be false', function() { + plugin.onConfigChange("shuffle_questions", false); + expect(plugin.config.shuffle_questions).toBeFalsy(); + }); + it('should set show_feedback to be false', function() { + plugin.onConfigChange("show_feedback", false); + expect(plugin.config.show_feedback).toBeFalsy(); + }); + it('should set optionShuffle to be false', function() { + plugin.onConfigChange("optionShuffle", true); + expect(plugin.config.optionShuffle).toBeTruthy(); + }); + it('should set shuffle_questions to be false', function() { + plugin.onConfigChange("btn_edit", "Edit"); + expect(ecEditor.dispatchEvent).toHaveBeenCalledWith('delete:invoke'); + }); + it('shuffle multiple question config change', function(done) { + var callback = {data: multiData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + config.initialize() + var modData = {"newValue":{"title":"test","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":true,"shuffle_options":false,"total_items":2,"btn_edit":"Edit"},"oldValue":{"title":"test","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":2,"btn_edit":"Edit"}}; + ecEditor.dispatchEvent('config:updateValue',modData,instance); + expect(ecEditor.dispatchEvent).toHaveBeenCalledWith('org.ekstep.toaster:info', { + title: 'Each question will carry equal weightage of 1 mark when using Shuffle. To provide different weightage to individual questions please turn off Shuffle.', + position: 'topCenter',}); + done(); + }, 500); + }); + }); + describe('Get Summery', function() { + + it('Get question summery', function(done) { + var callback = {data: multiData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + spyOn(instance, 'toECML').and.callThrough(); + ecEditor.dispatchEvent('org.ekstep.viewecml:show',{},undefined); + var summery = instance.getSummary(); + expect(summery.totalQuestions).toEqual(2); + expect(summery.totalScore).toEqual(2); + done(); + }, 500); + + }); + + }); + xdescribe('ToECML', function() { + var scope, $location, createController; + beforeAll(function(){ + angular.module('editorApp').controller('popupController', ['$scope', 'ngDialog', '$ocLazyLoad', '$templateCache', function ($scope, ngDialog, $ocLazyLoad, $templateCache) { + function loadNgModules (templatePath, controllerPath, allowTemplateCache) { + if (!allowTemplateCache) { + return $ocLazyLoad.load([ + { type: 'html', path: templatePath }, + { type: 'js', path: controllerPath + '?' + ecEditor.getConfig('build_number') } + ]) + } else { + if (angular.isString(templatePath) && templatePath.length > 0) { + angular.forEach(angular.element(templatePath), function (node) { + if (node.nodeName === 'SCRIPT' && node.type === 'text/ng-template') { + $templateCache.put(node.id, node.innerHTML) + } + }) + } + } + }; + + function openModal (config, callback) { + if (config && callback) config.preCloseCallback = callback + if (config) ngDialog.open(config) + }; + + function init () { + $scope.$on('ngDialog.closing', function () { + org.ekstep.services.telemetryService.interact({ 'type': 'hide', 'subtype': 'close', 'target': 'popup', 'pluginid': '', 'pluginver': '', 'objectid': '', 'stage': ecEditor.getCurrentStage().id }) + }) + }; + + init() + $scope.as = function() { + org.ekstep.contenteditor.api.getService('popup').initService(loadNgModules, openModal); + } + }]) + }) + beforeEach(module('editorApp')); + var $controller, $rootScope; + beforeEach(inject(function (_$controller_, _$rootScope_) { + + $controller = _$controller_; + $rootScope = _$rootScope_; + })); + it('Get question summery', function(done) { + + var $scope = $rootScope.$new(); + var controller = $controller('popupController', { $scope: $scope }); + $scope.as(); + console.log(window.location.href,"-----testing window location----------------"); + + var callback = {data: multiData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + + var localContext = { + $window:{ + location:{ + href:"http://localhost:3000/app/?contentId=do_212510946870812672120616" + } + } + } + with(localContext){ + org.ekstep.pluginframework.config.build_number = 1; + var instance = stage.children[stage.children.length-1]; + spyOn(instance, 'toECML').and.callThrough(); + ecEditor.dispatchEvent('org.ekstep.viewecml:show',{},undefined); + var summery = instance.getSummary(); + expect(summery.totalQuestions).toEqual(2); + expect(summery.totalScore).toEqual(2); + console.log($window.location.href,"-----testing window location----------------"); + // expect(instance.toECML).toHaveBeenCalled(); + done(); + } + }, 500); + + }); + it('should set total_items to 1', function(done) { + var callback = {data: multiData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + config.initialize() + var modData = {"newValue":{"title":"Newtest","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":true,"shuffle_options":false,"total_items":1,"btn_edit":"Edit"},"oldValue":{"title":"test","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":2,"btn_edit":"Edit"}}; + ecEditor.dispatchEvent('config:updateValue',modData,instance); + expect(plugin.config.total_items).toEqual(1); + done(); + }, 500); + }); + it('should set max_score to 1', function(done) { + var callback = {data: multiData, callBack: undefined } + ecEditor.dispatchEvent("org.ekstep.questionset:addQS", callback); + setTimeout(function _expect(){ + var instance = stage.children[stage.children.length-1]; + config.initialize() + var modData = {"newValue":{"title":"Newtest","max_score":1,"allow_skip":true,"show_feedback":true,"shuffle_questions":true,"shuffle_options":false,"total_items":2,"btn_edit":"Edit"},"oldValue":{"title":"test","max_score":2,"allow_skip":true,"show_feedback":true,"shuffle_questions":false,"shuffle_options":false,"total_items":2,"btn_edit":"Edit"}}; + ecEditor.dispatchEvent('config:updateValue',modData,instance); + expect(plugin.config.max_score).toEqual(1); + done(); + }, 500); + }); + + }); +}); +//# sourceURL=questionsetPlugin.spec.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/mocks/renderer/iterator-mock.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/mocks/renderer/iterator-mock.js new file mode 100644 index 000000000..32cf9e296 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/mocks/renderer/iterator-mock.js @@ -0,0 +1,19 @@ +var IteratorPlugin = Plugin.extend({ + _type: 'org.ekstep.iterator', + _isContainer: false, + _render: true, + _itemIndex: -1, + initialize: function() { + }, + registerNavigation: function(PluginInstance) { + EkstepRendererAPI.dispatchEvent('renderer:navigation:register', PluginInstance); + }, + deregisterNavigation: function(PluginInstance) { + EkstepRendererAPI.dispatchEvent('renderer:navigation:deregister', PluginInstance); + }, + handleNext: function() { + + }, + handlePrevious: function() { + } +}); \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/qs-feedback-popup.spec.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/qs-feedback-popup.spec.js new file mode 100644 index 000000000..70ad98dff --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/qs-feedback-popup.spec.js @@ -0,0 +1,47 @@ +describe('qs-feedback', function() { + beforeEach(function() { + spyOn($.fn, "show"); + spyOn($.fn, "hide"); + spyOn(QSFeedbackPopup, "hidePopup").and.callThrough(); + }); + + describe("showGoodJob", function() { + it('should call $.fn.show', function() { + QSFeedbackPopup.showGoodJob(); + expect($.fn.show).toHaveBeenCalled(); + }); + }); + + describe("hidePopup", function() { + it('should call $.fn.hide', function() { + QSFeedbackPopup.hidePopup(); + expect($.fn.hide).toHaveBeenCalled(); + }); + }); + describe("moveToNextStage", function() { + it('should call hidePopup', function() { + QSFeedbackPopup.moveToNextStage(); + expect(QSFeedbackPopup.hidePopup).toHaveBeenCalled(); + }); + }); + describe("showTryAgain", function() { + it('should call $.fn.show', function() { + QSFeedbackPopup.showTryAgain(); + expect($.fn.show).toHaveBeenCalled(); + }); + }); + describe("showRetry", function() { + it('should call hidePopup', function() { + QSFeedbackPopup.showRetry(); + expect(QSFeedbackPopup.hidePopup).toHaveBeenCalled(); + }); + }); + describe("qsPartialCorrect", function() { + it('should call setRendered', function() { + var partialScore = 2; + QSFeedbackPopup.qsPartialCorrect(partialScore); + expect($.fn.show).toHaveBeenCalled(); + }); + }) + +}) \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/question-set-plugin.spec.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/question-set-plugin.spec.js new file mode 100644 index 000000000..cb8bfef1e --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/question-set-plugin.spec.js @@ -0,0 +1,283 @@ +describe('org.ekstep.questionset', function() { + var questionSetPlugin, data, question, quizQuestion; + _constants = { + questionPluginId: 'org.ekstep.question', + qsElement: '#questionset', + qsPopup: 'qs-feedback-model-popup', + questionsetCSS: { + width: '100%', + position: 'absolute', + top: '2%', + left: 0, + height: '100%' + }, + feedbackCSS: { + position: 'absolute', + width: '100%', + height: '100%', + 'z-index': 999999, + top: 0, + display: 'none' + }, + qsPrefix: 'qs', + qsQuizPlugin: 'org.ekstep.questionset.quiz' + }; + + beforeEach(function() { + data = { + "x": 9, + "y": 6, + "w": 80, + "h": 85, + "rotate": 0, + "z-index": -1, + "id": "c5e08126-5ab9-488c-b0dc-70a8250a3235", + "org.ekstep.question": [{ + "id": "0a11ac6d-e801-425a-bd02-a43dea315dc9", + "type": "ftb", + "pluginId": "org.ekstep.questionunit.ftb", + "pluginVer": "1.0", + "templateId": "ftbtemplate", + "data": { + "__cdata": "{\"question\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು [[ಬಲವಾಗಿರುತ್ತದೆ]]

\\n\",\"image\":\"\",\"audio\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Custom\",\"customKeys\":\"ಬ,ಲ,ವಾ,ಗಿ,ರು,ತ್ತ,ದೆ\"}},\"answer\":[\"ಬಲವಾಗಿರುತ್ತದೆ\"],\"parsedQuestion\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು

\\n\",\"image\":\"\",\"audio\":\"\"}}" + }, + "config": { + "__cdata": "{\"metadata\":{\"category\":\"FTB\",\"title\":\"ಮರದ ಎತ್ತರ ಮತ್ತು ____\\n\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Grade 1\"],\"concepts\":[{\"identifier\":\"AI33\",\"name\":\"Perceptron\"}],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + }, { + "id": "514d0902-1566-453b-b6ee-6a263d2209b9", + "type": "mtf", + "pluginId": "org.ekstep.questionset.quiz", + "pluginVer": "1.0", + "templateId": "horizontalMCQ", + "data": { + "__cdata": "{\"questionnaire\":{\"items\":{\"do_1124686987616337921196\":[{\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5ab8c2e2436f7\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"type\":\"mtf\",\"title\":\"v1 sorting template\",\"createdOn\":\"2018-03-26T09:52:34.300+0000\",\"gradeLevel\":[\"KG\"],\"appId\":\"ekstep_portal\",\"lastUpdatedOn\":\"2018-03-26T09:52:34.300+0000\",\"used_for\":\"worksheet\",\"rhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"lion\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"lion\",\"resindex\":0},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"tiger\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"tiger\",\"resindex\":1},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Apple\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Apple\",\"resindex\":2},\"answer\":1},{\"value\":{\"type\":\"mixed\",\"text\":\"Mango\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Mango\",\"resindex\":3},\"answer\":1}],\"lastUpdatedBy\":\"597\",\"identifier\":\"do_1124686987616337921196\",\"question\":\"v1 sorting template\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522057954300\",\"framework\":\"NCF\",\"lhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"Animals\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Animals\",\"resindex\":0},\"index\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Fruits\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Fruits\",\"resindex\":1},\"index\":1}],\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":3,\"domain\":[\"literacy\"],\"name\":\"v1 sorting template\",\"template_id\":\"do_11239003529361817611\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1178\",\"template\":\"org.ekstep.mtf.sorting\"}]},\"item_sets\":[{\"count\":1,\"id\":\"do_1124686987616337921196\"}],\"title\":\"test\",\"max_score\":3,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"},\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":25,\"x\":0,\"y\":10},\"mtf\":{\"sorting\":{\"shape\":[{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"type\":\"rect\",\"stroke\":\"#4c4c4c\"},{\"w\":100,\"h\":0.5,\"x\":0,\"y\":18,\"fill\":\"#4c4c4c\",\"type\":\"rect\"}],\"text\":{\"z-index\":1,\"color\":\"#4c4c4c\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":5,\"model\":\"option.value.text\",\"valign\":\"top\",\"align\":\"center\"},\"snapX\":15,\"snapY\":16.5,\"h\":54,\"multiple\":true,\"marginX\":2,\"marginY\":2,\"layout\":\"table\",\"w\":100,\"options\":\"lhs_options\",\"x\":0,\"y\":28,\"cols\":4},\"sorts\":[{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":84,\"option\":\"rhs_options[0]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":84,\"option\":\"rhs_options[1]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":84,\"option\":\"rhs_options[2]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":84,\"option\":\"rhs_options[3]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":84,\"option\":\"rhs_options[4]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":84,\"option\":\"rhs_options[5]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":96,\"option\":\"rhs_options[6]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":96,\"option\":\"rhs_options[7]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":96,\"option\":\"rhs_options[8]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":96,\"option\":\"rhs_options[9]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":96,\"option\":\"rhs_options[10]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":96,\"option\":\"rhs_options[11]\"}],\"force\":false,\"model\":\"item\"},\"id\":\"org.ekstep.mtf.sorting\"}]}" + }, + "config": { + "__cdata": "{\"type\":\"items\",\"var\":\"item\"}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + }], + "data": { + "__cdata": "[{\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":25,\"x\":0,\"y\":10},\"mtf\":{\"sorting\":{\"shape\":[{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"type\":\"rect\",\"stroke\":\"#4c4c4c\"},{\"w\":100,\"h\":0.5,\"x\":0,\"y\":18,\"fill\":\"#4c4c4c\",\"type\":\"rect\"}],\"text\":{\"z-index\":1,\"color\":\"#4c4c4c\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":5,\"model\":\"option.value.text\",\"valign\":\"top\",\"align\":\"center\"},\"snapX\":15,\"snapY\":16.5,\"h\":54,\"multiple\":true,\"marginX\":2,\"marginY\":2,\"layout\":\"table\",\"w\":100,\"options\":\"lhs_options\",\"x\":0,\"y\":28,\"cols\":4},\"sorts\":[{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":84,\"option\":\"rhs_options[0]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":84,\"option\":\"rhs_options[1]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":84,\"option\":\"rhs_options[2]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":84,\"option\":\"rhs_options[3]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":84,\"option\":\"rhs_options[4]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":84,\"option\":\"rhs_options[5]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":96,\"option\":\"rhs_options[6]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":96,\"option\":\"rhs_options[7]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":96,\"option\":\"rhs_options[8]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":96,\"option\":\"rhs_options[9]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":96,\"option\":\"rhs_options[10]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":96,\"option\":\"rhs_options[11]\"}],\"force\":false,\"model\":\"item\"},\"id\":\"org.ekstep.mtf.sorting\"}],\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5ab8c2e2436f7\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"type\":\"mtf\",\"title\":\"v1 sorting template\",\"createdOn\":\"2018-03-26T09:52:34.300+0000\",\"gradeLevel\":[\"KG\"],\"appId\":\"ekstep_portal\",\"lastUpdatedOn\":\"2018-03-26T09:52:34.300+0000\",\"used_for\":\"worksheet\",\"rhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"lion\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"lion\",\"resindex\":0},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"tiger\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"tiger\",\"resindex\":1},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Apple\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Apple\",\"resindex\":2},\"answer\":1},{\"value\":{\"type\":\"mixed\",\"text\":\"Mango\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Mango\",\"resindex\":3},\"answer\":1}],\"lastUpdatedBy\":\"597\",\"identifier\":\"do_1124686987616337921196\",\"question\":\"v1 sorting template\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522057954300\",\"framework\":\"NCF\",\"lhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"Animals\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Animals\",\"resindex\":0},\"index\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Fruits\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Fruits\",\"resindex\":1},\"index\":1}],\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":3,\"domain\":[\"literacy\"],\"name\":\"v1 sorting template\",\"template_id\":\"do_11239003529361817611\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1178\",\"mediamanifest\":{\"media\":[{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481602/esl.png\",\"id\":\"esl\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481606/cat.png\",\"id\":\"cat\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481611/home.png\",\"id\":\"home\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481615/sortingdata.js\",\"id\":\"sorting\",\"type\":\"plugin\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481624/sort.js\",\"id\":\"sorts\",\"type\":\"plugin\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"}]}}]" + }, + "config": { + "__cdata": "{\"title\":\"test\",\"max_score\":3,\"allow_skip\":true,\"show_feedback\":false,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"}" + }, + "pluginType": "org.ekstep.questionset", + "font": "NotoSans, NotoSansGujarati, NotoSansOriya, NotoSansMalayalam" + }; + + quizQuestion = { + "id": "58e1b52e-90b6-4035-b226-00a197305e86", + "type": "mtf", + "pluginId": "org.ekstep.questionset.quiz", + "pluginVer": "1.0", + "templateId": "horizontalMCQ", + "data": { + "__cdata": "{\"questionnaire\":{\"items\":{\"do_1124686987616337921196\":[{\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5ab8c2e2436f7\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"type\":\"mtf\",\"title\":\"v1 sorting template\",\"createdOn\":\"2018-03-26T09:52:34.300+0000\",\"gradeLevel\":[\"KG\"],\"appId\":\"ekstep_portal\",\"lastUpdatedOn\":\"2018-03-26T09:52:34.300+0000\",\"used_for\":\"worksheet\",\"rhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"lion\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"lion\",\"resindex\":0},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"tiger\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"tiger\",\"resindex\":1},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Apple\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Apple\",\"resindex\":2},\"answer\":1},{\"value\":{\"type\":\"mixed\",\"text\":\"Mango\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Mango\",\"resindex\":3},\"answer\":1}],\"lastUpdatedBy\":\"597\",\"identifier\":\"do_1124686987616337921196\",\"question\":\"v1 sorting template\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522057954300\",\"framework\":\"NCF\",\"lhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"Animals\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Animals\",\"resindex\":0},\"index\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Fruits\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Fruits\",\"resindex\":1},\"index\":1}],\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":3,\"domain\":[\"literacy\"],\"name\":\"v1 sorting template\",\"template_id\":\"do_11239003529361817611\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1178\",\"template\":\"org.ekstep.mtf.sorting\"}]},\"item_sets\":[{\"count\":1,\"id\":\"do_1124686987616337921196\"}],\"title\":\"test\",\"max_score\":3,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"},\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":25,\"x\":0,\"y\":10},\"mtf\":{\"sorting\":{\"shape\":[{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"type\":\"rect\",\"stroke\":\"#4c4c4c\"},{\"w\":100,\"h\":0.5,\"x\":0,\"y\":18,\"fill\":\"#4c4c4c\",\"type\":\"rect\"}],\"text\":{\"z-index\":1,\"color\":\"#4c4c4c\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":5,\"model\":\"option.value.text\",\"valign\":\"top\",\"align\":\"center\"},\"snapX\":15,\"snapY\":16.5,\"h\":54,\"multiple\":true,\"marginX\":2,\"marginY\":2,\"layout\":\"table\",\"w\":100,\"options\":\"lhs_options\",\"x\":0,\"y\":28,\"cols\":4},\"sorts\":[{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":84,\"option\":\"rhs_options[0]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":84,\"option\":\"rhs_options[1]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":84,\"option\":\"rhs_options[2]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":84,\"option\":\"rhs_options[3]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":84,\"option\":\"rhs_options[4]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":84,\"option\":\"rhs_options[5]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":96,\"option\":\"rhs_options[6]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":96,\"option\":\"rhs_options[7]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":96,\"option\":\"rhs_options[8]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":96,\"option\":\"rhs_options[9]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":96,\"option\":\"rhs_options[10]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":96,\"option\":\"rhs_options[11]\"}],\"force\":false,\"model\":\"item\"},\"id\":\"org.ekstep.mtf.sorting\"}]}" + }, + "config": { + "__cdata": "{\"type\":\"items\",\"var\":\"item\"}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + }; + + question = { + "id": "0a11ac6d-e801-425a-bd02-a43dea315dc9", + "type": "ftb", + "pluginId": "org.ekstep.questionunit.ftb", + "pluginVer": "1.0", + "templateId": "ftbtemplate", + "data": { + "__cdata": "{\"question\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು [[ಬಲವಾಗಿರುತ್ತದೆ]]

\\n\",\"image\":\"\",\"audio\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Custom\",\"customKeys\":\"ಬ,ಲ,ವಾ,ಗಿ,ರು,ತ್ತ,ದೆ\"}},\"answer\":[\"ಬಲವಾಗಿರುತ್ತದೆ\"],\"parsedQuestion\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು

\\n\",\"image\":\"\",\"audio\":\"\"}}" + }, + "config": { + "__cdata": "{\"metadata\":{\"category\":\"FTB\",\"title\":\"ಮರದ ಎತ್ತರ ಮತ್ತು ____\\n\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Grade 1\"],\"concepts\":[{\"identifier\":\"AI33\",\"name\":\"Perceptron\"}],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + } + + + + + questionSetPlugin = new org.ekstep.questionsetRenderer(data, Renderer.theme._currentScene, Renderer.theme._currentScene, Renderer.theme); + + + questionSetPlugin._data = data; + questionSetPlugin._questionStates = { + "0a11ac6d-e801-425a-bd02-a43dea315dc9": { + val: "" + } + } + spyOn(questionSetPlugin, 'loadTemplateContainer'); + spyOn(questionSetPlugin, 'saveQuestionSetState'); + spyOn(questionSetPlugin, 'setRendered'); + spyOn(EkstepRendererAPI, 'dispatchEvent'); + spyOn(questionSetPlugin, 'renderNextQuestion'); + spyOn(QSFeedbackPopup, 'showGoodJob'); + spyOn(QSFeedbackPopup, 'showTryAgain'); + spyOn(questionSetPlugin, 'nextQuestion').and.callThrough(); + spyOn(questionSetPlugin, 'prevQuestion').and.callThrough(); + spyOn(questionSetPlugin, 'renderPrevQuestion'); + spyOn(questionSetPlugin, 'getPrevQuestion'); + spyOn(TelemetryService, 'navigate'); + spyOn(questionSetPlugin, 'generateNavigateTelemetry').and.callThrough(); + var themeObj = Renderer.theme; + spyOn(jQuery.fn, "remove"); + spyOn(themeObj, 'setParam'); + spyOn($.fn, "append"); + + }); + + describe("init plugin", function() { + it('should call loadTemplateContainer', function() { + + questionSetPlugin.initPlugin(data); + expect(questionSetPlugin.loadTemplateContainer).toHaveBeenCalled(); + }); + it('should call saveQuestionSetState', function() { + + questionSetPlugin.initPlugin(data); + expect(questionSetPlugin.saveQuestionSetState).toHaveBeenCalled(); + }); + + + }); + + describe("render Question", function() { + it('should call setRendered', function() { + + questionSetPlugin.renderQuestion(question); + expect(questionSetPlugin.setRendered).toHaveBeenCalled(); + }); + }); + + describe("set rendered", function() { + it('should set renderedquestions', function() { + + questionSetPlugin.setRendered(quizQuestion); + expect(questionSetPlugin._renderedQuestions).not.toBe(undefined); + }); + + }); + + describe("end Of QuestionSet", function() { + it('should set return true', function() { + questionSetPlugin._renderedQuestions.push(question); + var res = questionSetPlugin.endOfQuestionSet(); + expect(res).toBe(true); + }); + }); + + describe("next Question", function() { + it('should call renderNextQuestion', function() { + questionSetPlugin._displayedPopup = true; + questionSetPlugin.nextQuestion(); + expect(questionSetPlugin.renderNextQuestion).toHaveBeenCalled(); + }); + }); + + describe("display Feedback", function() { + it('should call showGoodJob', function() { + questionSetPlugin._displayedPopup = true; + var result = { + "eval": true, + "pass": true + } + questionSetPlugin.displayFeedback(result); + expect(QSFeedbackPopup.showGoodJob).toHaveBeenCalled(); + }); + }); + describe("display Feedback", function() { + it('should call showTryAgain', function() { + questionSetPlugin._displayedPopup = true; + var result = { + "eval": false, + "pass": false + } + questionSetPlugin.displayFeedback(result); + expect(QSFeedbackPopup.showTryAgain).toHaveBeenCalled(); + }); + }); + describe("prevQuestion", function() { + it('should call renderPrevQuestion', function() { + questionSetPlugin.prevQuestion(); + expect(questionSetPlugin.renderPrevQuestion).toHaveBeenCalled(); + }); + }); + + describe("getPrevQuestion", function() { + it('should return a value', function() { + var res = questionSetPlugin.getPrevQuestion(); + expect(res).toBe(undefined); + }); + }); + + describe("getRenderedIndex", function() { + it('should return index', function() { + var res = questionSetPlugin.getRenderedIndex(); + expect(res).toBe(0); + }); + }); + + describe("resetQS", function() { + it('should dispatch event', function() { + questionSetPlugin.resetQS(); + expect(EkstepRendererAPI.dispatchEvent).toHaveBeenCalled(); + }); + }); + + describe("getQuestionState", function() { + it('should return question state', function() { + var res = questionSetPlugin.getQuestionState('0a11ac6d-e801-425a-bd02-a43dea315dc9'); + expect(res).not.toBe(undefined); + }); + }); + + describe("resetTemplates", function() { + it('should call jQuery remove function', function() { + questionSetPlugin.resetTemplates(); + expect(jQuery.fn.remove).toHaveBeenCalled(); + }); + }); + + + + describe("generateNavigateTelemetry", function() { + it('should return index', function() { + questionSetPlugin.generateNavigateTelemetry(); + expect(TelemetryService.navigate).toHaveBeenCalled(); + }); + }); + + + describe("handleNext", function() { + it('should call showTryAgain', function() { + questionSetPlugin.handleNext(); + expect(questionSetPlugin.nextQuestion).toHaveBeenCalled(); + }); + }); + + describe("handlePrevious", function() { + it('should call showTryAgain', function() { + questionSetPlugin.handlePrevious(); + expect(questionSetPlugin.prevQuestion).toHaveBeenCalled(); + }); + }); + + +}); \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/telemetry-logger.spec.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/telemetry-logger.spec.js new file mode 100644 index 000000000..84badede9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionset-1.0/test/renderer/telemetry-logger.spec.js @@ -0,0 +1,134 @@ +describe('qs-feedback', function() { + + var data, question; + beforeEach(function() { + data = { + "x": 9, + "y": 6, + "w": 80, + "h": 85, + "rotate": 0, + "z-index": -1, + "id": "c5e08126-5ab9-488c-b0dc-70a8250a3235", + "org.ekstep.question": [{ + "id": "514d0902-1566-453b-b6ee-6a263d2209b9", + "type": "mtf", + "pluginId": "org.ekstep.questionset.quiz", + "pluginVer": "1.0", + "templateId": "horizontalMCQ", + "data": { + "__cdata": "{\"questionnaire\":{\"items\":{\"do_1124686987616337921196\":[{\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5ab8c2e2436f7\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"type\":\"mtf\",\"title\":\"v1 sorting template\",\"createdOn\":\"2018-03-26T09:52:34.300+0000\",\"gradeLevel\":[\"KG\"],\"appId\":\"ekstep_portal\",\"lastUpdatedOn\":\"2018-03-26T09:52:34.300+0000\",\"used_for\":\"worksheet\",\"rhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"lion\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"lion\",\"resindex\":0},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"tiger\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"tiger\",\"resindex\":1},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Apple\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Apple\",\"resindex\":2},\"answer\":1},{\"value\":{\"type\":\"mixed\",\"text\":\"Mango\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Mango\",\"resindex\":3},\"answer\":1}],\"lastUpdatedBy\":\"597\",\"identifier\":\"do_1124686987616337921196\",\"question\":\"v1 sorting template\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522057954300\",\"framework\":\"NCF\",\"lhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"Animals\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Animals\",\"resindex\":0},\"index\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Fruits\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Fruits\",\"resindex\":1},\"index\":1}],\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":3,\"domain\":[\"literacy\"],\"name\":\"v1 sorting template\",\"template_id\":\"do_11239003529361817611\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1178\",\"template\":\"org.ekstep.mtf.sorting\"}]},\"item_sets\":[{\"count\":1,\"id\":\"do_1124686987616337921196\"}],\"title\":\"test\",\"max_score\":3,\"allow_skip\":true,\"show_feedback\":true,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"},\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":25,\"x\":0,\"y\":10},\"mtf\":{\"sorting\":{\"shape\":[{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"type\":\"rect\",\"stroke\":\"#4c4c4c\"},{\"w\":100,\"h\":0.5,\"x\":0,\"y\":18,\"fill\":\"#4c4c4c\",\"type\":\"rect\"}],\"text\":{\"z-index\":1,\"color\":\"#4c4c4c\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":5,\"model\":\"option.value.text\",\"valign\":\"top\",\"align\":\"center\"},\"snapX\":15,\"snapY\":16.5,\"h\":54,\"multiple\":true,\"marginX\":2,\"marginY\":2,\"layout\":\"table\",\"w\":100,\"options\":\"lhs_options\",\"x\":0,\"y\":28,\"cols\":4},\"sorts\":[{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":84,\"option\":\"rhs_options[0]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":84,\"option\":\"rhs_options[1]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":84,\"option\":\"rhs_options[2]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":84,\"option\":\"rhs_options[3]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":84,\"option\":\"rhs_options[4]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":84,\"option\":\"rhs_options[5]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":96,\"option\":\"rhs_options[6]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":96,\"option\":\"rhs_options[7]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":96,\"option\":\"rhs_options[8]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":96,\"option\":\"rhs_options[9]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":96,\"option\":\"rhs_options[10]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":96,\"option\":\"rhs_options[11]\"}],\"force\":false,\"model\":\"item\"},\"id\":\"org.ekstep.mtf.sorting\"}]}" + }, + "config": { + "__cdata": "{\"type\":\"items\",\"var\":\"item\"}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + }], + "data": { + "__cdata": "[{\"template\":[{\"text\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"color\":\"#4c4c4c\",\"w\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":10,\"lineHeight\":1.4,\"model\":\"item.question\",\"valign\":\"top\",\"align\":\"center\"},\"shape\":{\"event\":{\"action\":[{\"asset_model\":\"item.question_audio\",\"sound\":true,\"type\":\"command\",\"command\":\"stop\"},{\"asset_model\":\"item.question_audio\",\"type\":\"command\",\"command\":\"play\"}],\"type\":\"click\"},\"hitArea\":true,\"w\":100,\"h\":25,\"x\":0,\"y\":10},\"mtf\":{\"sorting\":{\"shape\":[{\"w\":100,\"h\":100,\"x\":0,\"y\":0,\"type\":\"rect\",\"stroke\":\"#4c4c4c\"},{\"w\":100,\"h\":0.5,\"x\":0,\"y\":18,\"fill\":\"#4c4c4c\",\"type\":\"rect\"}],\"text\":{\"z-index\":1,\"color\":\"#4c4c4c\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"3vw\",\"y\":5,\"model\":\"option.value.text\",\"valign\":\"top\",\"align\":\"center\"},\"snapX\":15,\"snapY\":16.5,\"h\":54,\"multiple\":true,\"marginX\":2,\"marginY\":2,\"layout\":\"table\",\"w\":100,\"options\":\"lhs_options\",\"x\":0,\"y\":28,\"cols\":4},\"sorts\":[{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":84,\"option\":\"rhs_options[0]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":84,\"option\":\"rhs_options[1]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":84,\"option\":\"rhs_options[2]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":84,\"option\":\"rhs_options[3]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":84,\"option\":\"rhs_options[4]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":84,\"option\":\"rhs_options[5]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":0,\"y\":96,\"option\":\"rhs_options[6]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":16.5,\"y\":96,\"option\":\"rhs_options[7]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":33,\"y\":96,\"option\":\"rhs_options[8]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":49.5,\"y\":96,\"option\":\"rhs_options[9]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":66,\"y\":96,\"option\":\"rhs_options[10]\"},{\"text\":{\"color\":\"blue\",\"w\":100,\"h\":100,\"x\":0,\"fontsize\":\"2.3vw\",\"y\":0,\"model\":\"option.value.text\",\"valign\":\"middle\",\"align\":\"center\"},\"g\":{\"image\":{\"w\":100,\"x\":0,\"y\":0,\"model\":\"option.value.image\",\"align\":\"center\"},\"w\":100,\"h\":70,\"x\":0,\"y\":15},\"w\":15,\"h\":12,\"x\":82.5,\"y\":96,\"option\":\"rhs_options[11]\"}],\"force\":false,\"model\":\"item\"},\"id\":\"org.ekstep.mtf.sorting\"}],\"itemType\":\"UNIT\",\"code\":\"org.ekstep.assessmentitem.literacy_5ab8c2e2436f7\",\"subject\":\"domain\",\"qlevel\":\"EASY\",\"channel\":\"in.ekstep\",\"description\":\"\",\"language\":[\"English\"],\"type\":\"mtf\",\"title\":\"v1 sorting template\",\"createdOn\":\"2018-03-26T09:52:34.300+0000\",\"gradeLevel\":[\"KG\"],\"appId\":\"ekstep_portal\",\"lastUpdatedOn\":\"2018-03-26T09:52:34.300+0000\",\"used_for\":\"worksheet\",\"rhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"lion\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"lion\",\"resindex\":0},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"tiger\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"tiger\",\"resindex\":1},\"answer\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Apple\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Apple\",\"resindex\":2},\"answer\":1},{\"value\":{\"type\":\"mixed\",\"text\":\"Mango\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Mango\",\"resindex\":3},\"answer\":1}],\"lastUpdatedBy\":\"597\",\"identifier\":\"do_1124686987616337921196\",\"question\":\"v1 sorting template\",\"consumerId\":\"f6878ac4-e9c9-4bc4-80be-298c5a73b447\",\"version\":1,\"versionKey\":\"1522057954300\",\"framework\":\"NCF\",\"lhs_options\":[{\"value\":{\"type\":\"mixed\",\"text\":\"Animals\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Animals\",\"resindex\":0},\"index\":0},{\"value\":{\"type\":\"mixed\",\"text\":\"Fruits\",\"image\":\"\",\"count\":\"\",\"audio\":\"\",\"resvalue\":\"Fruits\",\"resindex\":1},\"index\":1}],\"concepts\":[{\"identifier\":\"LO4\",\"name\":\"Understanding of Grammar/Syntax\",\"objectType\":\"Concept\",\"relation\":\"associatedTo\",\"description\":null,\"index\":null,\"status\":null,\"depth\":null,\"mimeType\":null,\"visibility\":null,\"compatibilityLevel\":null}],\"createdBy\":\"597\",\"max_score\":3,\"domain\":[\"literacy\"],\"name\":\"v1 sorting template\",\"template_id\":\"do_11239003529361817611\",\"category\":\"MCQ\",\"status\":\"Live\",\"isSelected\":true,\"$$hashKey\":\"object:1178\",\"mediamanifest\":{\"media\":[{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481602/esl.png\",\"id\":\"esl\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481606/cat.png\",\"id\":\"cat\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481611/home.png\",\"id\":\"home\",\"type\":\"image\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481615/sortingdata.js\",\"id\":\"sorting\",\"type\":\"plugin\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"},{\"src\":\"https://dev.ekstep.in/assets/public/content/do_11239003529361817611/assets/1512455481624/sort.js\",\"id\":\"sorts\",\"type\":\"plugin\",\"plugin\":\"org.ekstep.questionset\",\"ver\":\"1.0\"}]}}]" + }, + "config": { + "__cdata": "{\"title\":\"test\",\"max_score\":3,\"allow_skip\":true,\"show_feedback\":false,\"shuffle_questions\":false,\"shuffle_options\":false,\"total_items\":1,\"btn_edit\":\"Edit\"}" + }, + "pluginType": "org.ekstep.questionset", + "font": "NotoSans, NotoSansGujarati, NotoSansOriya, NotoSansMalayalam" + }; + + Renderer.theme._currentStage = 123; + + question = { + "id": "0a11ac6d-e801-425a-bd02-a43dea315dc9", + "type": "ftb", + "pluginId": "org.ekstep.questionunit.ftb", + "pluginVer": "1.0", + "templateId": "ftbtemplate", + "data": { + "__cdata": "{\"question\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು [[ಬಲವಾಗಿರುತ್ತದೆ]]

\\n\",\"image\":\"\",\"audio\":\"\",\"keyboardConfig\":{\"keyboardType\":\"Custom\",\"customKeys\":\"ಬ,ಲ,ವಾ,ಗಿ,ರು,ತ್ತ,ದೆ\"}},\"answer\":[\"ಬಲವಾಗಿರುತ್ತದೆ\"],\"parsedQuestion\":{\"text\":\"

ಮರದ ಎತ್ತರ ಮತ್ತು

\\n\",\"image\":\"\",\"audio\":\"\"}}" + }, + "config": { + "__cdata": "{\"metadata\":{\"category\":\"FTB\",\"title\":\"ಮರದ ಎತ್ತರ ಮತ್ತು ____\\n\",\"language\":[\"English\"],\"qlevel\":\"EASY\",\"gradeLevel\":[\"Grade 1\"],\"concepts\":[{\"identifier\":\"AI33\",\"name\":\"Perceptron\"}],\"description\":\"test\",\"max_score\":1},\"max_time\":0,\"max_score\":1,\"partial_scoring\":true,\"layout\":\"Horizontal\",\"isShuffleOption\":false}" + }, + "w": 80, + "h": 85, + "x": 9, + "y": 6 + }; + + spyOn(TelemetryService, 'interact'); + spyOn(TelemetryService, 'itemResponse'); + spyOn(TelemetryService, 'assessEnd'); + spyOn(QSTelemetryLogger, 'logInteract').and.callThrough(); + spyOn(QSTelemetryLogger, 'logResponse').and.callThrough(); + spyOn(QSTelemetryLogger, 'logAssess').and.callThrough(); + spyOn(QSTelemetryLogger, 'logAssessEnd').and.callThrough(); + + }); + + describe("setQuestion", function() { + it('should set QSTelemetryLogger._qConfig', function() { + QSTelemetryLogger.setQuestion(question); + expect(QSTelemetryLogger._qConfig).not.toBe(undefined); + }); + }); + + describe("logInteract", function() { + it('should call TelemetryService interact', function() { + QSTelemetryLogger.logInteract(data); + expect(TelemetryService.interact).toHaveBeenCalled(); + }); + }); + + describe("logResponse", function() { + it('should call TelemetryService itemResponse', function() { + QSTelemetryLogger._plugin = {}; + QSTelemetryLogger._plugin._manifest = {}; + QSTelemetryLogger.logResponse(data); + expect(TelemetryService.itemResponse).toHaveBeenCalled(); + }); + }); + + describe("logAssess", function() { + it('should set assessStart', function() { + QSTelemetryLogger.logAssess(); + expect(QSTelemetryLogger._assessStart).not.toBe(undefined); + }); + }); + + describe("logAssessEnd", function() { + it('should call TelemetryService assessEnd', function() { + var result = { + "eval": true, + "score": 2, + "values": [] + } + QSTelemetryLogger.logAssessEnd(result); + expect(TelemetryService.assessEnd).toHaveBeenCalled(); + }); + }); + + describe("logEvent", function() { + it('should call QSTelemetryLogger logInteract', function() { + var type = 'TOUCH'; + QSTelemetryLogger.logEvent(type, data); + expect(QSTelemetryLogger.logInteract).toHaveBeenCalled(); + }); + it('should call QSTelemetryLogger logInteract', function() { + var type = 'DRAG'; + QSTelemetryLogger.logEvent(type, data); + expect(QSTelemetryLogger.logInteract).toHaveBeenCalled(); + }); + it('should call TelemetryService logAssess', function() { + var type = 'ASSESS'; + QSTelemetryLogger.logEvent(type, data); + expect(QSTelemetryLogger.logAssess).toHaveBeenCalled(); + }); + it('should call TelemetryService logResponse', function() { + var type = 'RESPONSE'; + QSTelemetryLogger.logEvent(type, data); + expect(QSTelemetryLogger.logResponse).toHaveBeenCalled(); + }); + }); +}) \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintignore b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintignore new file mode 100644 index 000000000..2f36f26d3 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintignore @@ -0,0 +1 @@ +libs/ \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintrc.yaml b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintrc.yaml new file mode 100644 index 000000000..9c96e38a3 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.eslintrc.yaml @@ -0,0 +1,3 @@ +extends: "ekstep-content-plugin" +rules: + indent: ["error", 2, { "SwitchCase": 1 }] \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.gitignore b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.gitignore new file mode 100644 index 000000000..1ca5639d4 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +node_modules +bower_components +coverage +docs +dist +npm-debug.log \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/Jenkinsfile b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/Jenkinsfile new file mode 100644 index 000000000..ad419e8a9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/Jenkinsfile @@ -0,0 +1,5 @@ +@Library('ekstep-content-plugin-jenkins-common') _ + +buildContentPlugin { + +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/README.md b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/README.md new file mode 100644 index 000000000..62c23de2b --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/README.md @@ -0,0 +1,11 @@ +# org.ekstep.plugins.test + +This plugin is an example plugin + +### Usage + +How do people use this plugin? + +### Development + +Please refer to [wiki](https://github.com/ekstep/Contributed-Plugins/wiki) for plugin development guidelines \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/down_arrow.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/down_arrow.png new file mode 100644 index 000000000..e6d74145b Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/down_arrow.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/icon.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/icon.png new file mode 100644 index 000000000..5d0d0df9d Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/assets/icon.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bin/updateFrameworkDependencies.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bin/updateFrameworkDependencies.js new file mode 100644 index 000000000..b9a9348e9 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bin/updateFrameworkDependencies.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node + +var rimraf = require('rimraf'); +var execSync = require('child_process').execSync; + +rimraf.sync('bower_components/ekstep-content-plugin-dev-common'); +rimraf.sync('node_modules/ekstep-content-plugin-dev-common'); +execSync('npm install', { stdio: 'inherit' }); +require('ekstep-content-plugin-dev-common/bin/updateFrameworkDependencies.js'); diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bower.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bower.json new file mode 100644 index 000000000..dc89c149e --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/bower.json @@ -0,0 +1,6 @@ +{ + "name": "org.ekstep.plugins.test", + "dependencies": { + "ekstep-content-plugin-dev-common": "ekstep/ekstep-content-plugin-dev-common" + } +} diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/ckeditor-config.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/ckeditor-config.js new file mode 100644 index 000000000..e2db2c378 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/ckeditor-config.js @@ -0,0 +1,96 @@ +/** + * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ +CKEDITOR.editorConfig = function (config) { + + config.extraPlugins = 'rtl,notification,font,justify,colorbutton,mathtext,wordcount,pastefromword,clipboard'; + + // Mathtext related config + config.katexCSS = CKEDITOR.basePath + 'plugins/mathtext/libs/katex/katex.min.css'; + config.katexJS = CKEDITOR.basePath + 'plugins/mathtext/libs/katex/katex.min.js'; + + // Set the filter file (this is the default) + config.pasteFromWordCleanupFile = CKEDITOR.basePath + 'plugins/pastefromword/filter/default.js'; + config.customConfig = ecEditor.resolvePluginResource('org.ekstep.libs.ckeditor', '1.1', 'editor/ckeditor/plugins/clipboard/dialogs/paste.js'); + config.allowedContent = true; + config.language = 'en'; + + // All content will be pasted as plain text. + config.forcePasteAsPlainText = true; + config.pasteFilter = 'plain-text'; + + config.toolbarGroups = [ + //{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, + // { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] }, + // { name: 'links' }, + // { name: 'insert' }, + // { name: 'forms' }, + // { name: 'tools' }, + // { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, + // { name: 'others' }, + '/', + {name: 'basicstyles', groups: ['basicstyles']}, + // {name: 'paragraph', groups: ['list', 'align']}, + {name: 'styles'}, + {name: 'colors'}, + {name: 'input'}, + {name: 'cleanup'} + ]; + // Font pixel to wm conversion done based on taking 14px = 1em; + config.fontSize_sizes = '10/0.714em;12/0.857em;14/1em;16/1.142em;18/1.285714285em;20/1.428571428em;22/1.571428571em;24/1.714285714em;26/1.857142857em;28/2em;'; + + // config.fontSize_defaultLabel = '18'; + + config.removePlugins = 'stylescombo, magicline'; + + // Remove some buttons provided by the standard plugins, which are + // not needed in the Standard(s) toolbar. + config.removeButtons = 'Subscript,Superscript,Font,Format,Strike'; + + // Set the most common block elemnts. + // config.format_tags = 'p;h1;h2;h3'; + + // Simplify the dialog windows. + config.removeDialogTabs = 'image:advanced;link:advanced'; + + config.wordcount = { + + // Whether or not you want to show the Paragraphs Count + showParagraphs: false, + + // Whether or not you want to show the Word Count + showWordCount: false, + + // Whether or not you want to show the Char Count + showCharCount: true, + + // Whether or not you want to count Spaces as Chars + countSpacesAsChars: true, + + // Whether or not to include Html chars in the Char Count + countHTML: false, + + // Maximum allowed Word Count, -1 is default for unlimited + maxWordCount: -1, + + // Maximum allowed Char Count, -1 is default for unlimited + maxCharCount: 1000, + + // Add filter to add or remove element before counting (see CKEDITOR.htmlParser.filter), Default value : null (no filter) + filter: new CKEDITOR.htmlParser.filter({ + elements: { + div: function (element) { + if (element.attributes.class == 'mediaembed') { + return false; + } + } + } + }) + }; +}; + +// Overrride ckeditor line-height css to 1.3 +CKEDITOR.addCss('.cke_editable { line-height: 1.3 !important; }'); + +//# sourceURL=editorConfig.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/help.md b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/help.md new file mode 100644 index 000000000..70186d5b5 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/help.md @@ -0,0 +1 @@ +***org.ekstep.questionunit*** \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/js/util.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/js/util.js new file mode 100644 index 000000000..a1621d0f0 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/js/util.js @@ -0,0 +1,76 @@ +/** + * Angular Service to help reuse code across MTF, FTB and MCQ templates for logging + * telemetry events and also to invoke the asset browser. This is a place holder for + * any functionality that needs to be reused across these templates. + * + * @author: Siva K (sivashanmugam.kannan@funtoot.com), Ram J (ram.j@funtoot.com) + */ +var orgEkstepQuestion = angular.module('orgEkstepQuestion',[]); +orgEkstepQuestion.service('questionServices', ['$http', function ($http) { + this.invokeAssetBrowser = function (callbackObj) { + ecEditor.dispatchEvent('org.ekstep.assetbrowser:show', callbackObj); + } + + this.generateTelemetry = function (data) { + if (data) ecEditor.getService('telemetry').interact({ + "type": data.type, + "id": data.id, + "pageid": data.form, + "target": { + "id": data.target.id, + "ver": data.target.ver, + "type": data.target.type + }, + "plugin": data.plugin + }) + } +}]); + +/** + * Angular directive for uniform handling of media (image and audio) selected into + * question elements (Question or Options). + * + * @author: Siva K (sivashanmugam.kannan@funtoot.com), Ram J (ram.j@funtoot.com) + */ +angular.module('org.ekstep.question').directive('selectedMediaContainer', function () { + return { + scope: { + formdata: '=', + callbacks: '=mediaCallbacks', + qEleType: '@mediaType', + mediaIndex: '@mediaIndex' + }, + template: '
\ +
\ +
\ +
\ + \ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ + \ +

{{formdata.audioName}}

\ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ + ' + }; +}); + +//# sourceURL=questionunit-util.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/plugin.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/plugin.js new file mode 100644 index 000000000..936cf5e0b --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/plugin.js @@ -0,0 +1,60 @@ +/** + * Question Unit Base Plugin that declares the interfaces that Question Unit Plugins must define. + * @class org.ekstep.contenteditor.questionUnitPlugin + * @extends org.ekstep.contenteditor.basePlugin + * @author Jagadish Pujari + */ +org.ekstep.contenteditor.questionUnitPlugin = org.ekstep.contenteditor.basePlugin.extend({ + type: "org.ekstep.contenteditor.questionUnitPlugin", + _data: {}, + /** + * Initialize the plugin + * Load CKEditor, call beforeInit and beforeInit + */ + initialize: function () { + this.beforeInit(); + + this.afterInit(); + }, + /** + * Actions to be performed before the question form is rendered. + * This method may be overridden if HTML actions needs to be binded + */ + beforeInit: function() { + + }, + /** + * Actions to be performed after the question form is rendered. + * This method may be overridden if HTML actions needs to be binded + */ + afterInit: function() { + + }, + /** + * Set the question data + * While editing existing question + * @param {object} data - question data + */ + renderForm: function(data) { + this._data = data; + var instance = this; + ecEditor.addEventListener("org.ekstep.questionunit:ready",function(){ + ecEditor.dispatchEvent(instance.manifest.id + ":editquestion",data); + }); + }, + /** + * Set the question to _data. + * Dispatch event to particular question unit plugin(MCQ/FTB/MTF) + * @param {function} callback - question plugin validation + */ + validateForm: function(callback) { + var instance = this; + ecEditor.dispatchEvent(this.manifest.id + ":validateform", function(isValid, data) { + instance._data = data; + if(_.isFunction(callback)) { + callback(isValid,data); + } + }); + } +}); +//# sourceURL=questionUnitPlugin.js \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/styles/styles.css b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/styles/styles.css new file mode 100644 index 000000000..1b031b14a --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/editor/styles/styles.css @@ -0,0 +1,84 @@ +/* Editor Selected Media Container */ + +.question-selected-media-container { + height: 80px; + margin-bottom: 15px; +} + +.selected-image-container { + height: 100%; + border: 1px solid #9E9E9E; + border-radius: 6px; + float: left; + width: 30%; + margin-right: 15px; +} + +.image-container { + height: 100%; + float: left; + overflow: hidden; + width: 80%; + border-radius: 6px; +} + +.selected-image { + cursor: pointer; + max-width: 100%; + height: 100%; +} + +.selected-audio-container { + height: 100%; + border: 1px solid #9E9E9E; + border-radius: 6px; + float: left; + width: 30%; + margin-right: 15px; +} + +.audio-name-delete-container { + height: 50%; +} + +.auto-play-container { + margin: 10px; +} + +.audio-container { + cursor: pointer; + height: 100%; + float: left; + overflow: hidden; + width: 80%; +} + +.selected-audio { + max-width: 100%; + display: none; +} + +.audio-container .music { + float: left; + padding: 4px; +} + +.audio-container p { + white-space: nowrap; + width: 80%; + overflow: hidden; + text-overflow: ellipsis; + padding: 4px; +} + +.audio-container audio { + display: none; +} + +.delete-media-container { + margin-top: 10px; + float: left; + width: 20%; + height: 100%; + text-align: center; +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/gulpfile.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/gulpfile.js new file mode 100644 index 000000000..1a3fe411d --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/gulpfile.js @@ -0,0 +1 @@ +require('ekstep-content-plugin-dev-common/lib/gulp-tasks')(); \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/manifest.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/manifest.json new file mode 100644 index 000000000..79cc411b2 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/manifest.json @@ -0,0 +1,125 @@ +{ + "id": "org.ekstep.questionunit", + "ver": "1.1", + "author": "Jagadish Pujari", + "type": "plugin", + "title": "Question Unit Base Plugin", + "description": "Question Unit Base Plugin that declares the interfaces that Question Unit Plugins must define.", + "publishedDate": "", + "editor": { + "main": "editor/plugin.js", + "dependencies": [ + { + "type": "css", + "src": "editor/styles/styles.css" + }, + { + "type": "js", + "src": "editor/js/util.js" + }, + { + "type": "plugin", + "plugin": "org.ekstep.mathtext", + "ver": "1.0" + }, + { + "type": "plugin", + "plugin": "org.ekstep.libs.ckeditor", + "ver": "1.1" + } + ], + "help": { + "src": "editor/help.md", + "dataType": "text" + } + }, + "renderer": { + "main": "renderer/plugin.js", + "dependencies": [ + { + "type": "image", + "src": "renderer/assets/audio-icon.png", + "id": "org.ekstep.questionunit.renderer.audioicon", + "assetId": "org.ekstep.questionunit.renderer.audioicon" + }, + { + "type": "image", + "src": "renderer/assets/down_arrow.png", + "id": "org.ekstep.questionunit.renderer.downarrow", + "assetId": "org.ekstep.questionunit.renderer.downarrow" + }, + { + "type": "image", + "src": "renderer/assets/zoom.png", + "id": "org.ekstep.questionunit.renderer.zoom", + "assetId": "org.ekstep.questionunit.renderer.zoom" + }, + { + "type": "image", + "src": "renderer/assets/audio-icon1.png", + "id": "org.ekstep.questionunit.renderer.audio-icon1", + "assetId": "org.ekstep.questionunit.renderer.audio-icon1" + }, + { + "type": "js", + "src": "renderer/components/js/components.js" + }, + { + "type": "css", + "src": "renderer/components/css/components.css" + }, + { + "type": "js", + "src": "renderer/libs/katex/katex.min.js" + }, + { + "type": "css", + "src": "renderer/libs/katex/katex.min.css" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_main-bold.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_main-bolditalic.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_main-italic.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_main-regular.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_math-bolditalic.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_math-italic.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_math-regular.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_size1-regular.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_size2-regular.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_size3-regular.ttf" + }, + { + "type": "js", + "src": "renderer/libs/katex/fonts/katex_size4-regular.ttf" + } + ] + } +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/package.json b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/package.json new file mode 100644 index 000000000..6504595df --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/package.json @@ -0,0 +1,9 @@ +{ + "name": "org.ekstep.plugins.test", + "scripts": { + "build": "npm install && node bin/updateFrameworkDependencies.js && gulp" + }, + "devDependencies": { + "ekstep-content-plugin-dev-common": "ekstep/ekstep-content-plugin-dev-common" + } +} diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon.png new file mode 100644 index 000000000..f6ae0565e Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon1.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon1.png new file mode 100644 index 000000000..3c173cfde Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/audio-icon1.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/down_arrow.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/down_arrow.png new file mode 100644 index 000000000..e6d74145b Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/down_arrow.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/zoom.png b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/zoom.png new file mode 100644 index 000000000..97caa0368 Binary files /dev/null and b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/assets/zoom.png differ diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/css/components.css b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/css/components.css new file mode 100644 index 000000000..81ee06f8f --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/css/components.css @@ -0,0 +1,409 @@ +body { + font-family: NotoSans, NotoSansOriya, NotoSansGujarati, NotoSansMalayalam; + line-height: normal; +} + +/* overiding katex css */ +.math-text .katex-display { + margin: 0.2em 0 !important; +} + +/*end */ + +/* From here image model popup style */ + +.qc-popup-close-button { + cursor: pointer; + position: absolute; + right: -35px; + color: white; + bottom: 87%; +} + +#image-model-popup { + z-index: 100001; + /* Z index 100001 to hide the menu and refresh icon which has 100000 */ + position: fixed; + top: 0; + left: 0; + height: 100%; +} + +#image-model-popup .popup-overlay { + opacity: 0.8; +} + +#image-model-popup .popup-full-body { + width: auto; + margin: auto; +} + +#image-model-popup .assess-popup { + position: relative; + width: fit-content; + top: 0; + left: 0; + margin: auto; +} + +#image-model-popup img.qc-question-fullimage { + max-width: 60vw; + max-height: 100%; +} + +#image-model-popup .qc-popup-close-button { + position: absolute; + right: -15px; + top: -20px; + color: white; + font-size: 20px; +} + +/* question component css */ + +.absolute-center { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + justify-content: center; + display: flex; + align-items: center; +} + +.question-container .image-container img.audio, +.question-container .image-container img.q-image { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + margin: auto; +} + +.question-container { + height: 100%; + background-color: #FFFFFF; + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15); + position: relative; + z-index: 3; +} + +.question-container .image-container { + width: 14%; + float: left; + top: 0; + position: absolute; + z-index: 2; + height: 100%; + margin-left: 9%; +} + +.question-container .image-container img.q-image { + max-width: 100%; + max-height: 100%; + float: left; + right: 0; +} + +.question-container img.audio { + position: absolute; + right: 1.5%; + top: 10%; + height: 50%; + z-index: 9; + cursor: pointer; +} + +.question-container img.audio.no-q-image { + position: absolute; + right: 0; + top: 0; + height: 50%; + z-index: 9; + cursor: pointer; +} + +.question-container .hiding-container { + width: 100%; + height: 100%; + padding-left: 25%; + padding-right: 10%; + overflow: hidden; + background: white; + position: absolute; + z-index: 1; +} + +.question-container .hiding-container .expand-container { + max-height: 70vh; + width: 100%; + overflow: scroll; + overflow-x: hidden; +} + +.question-container .hiding-container .expand-container::-webkit-scrollbar { + width: 0px; + /* remove scrollbar space */ + background: transparent; + /* optional: just make scrollbar invisible */ +} + +/* optional: show position indicator in red */ + +.question-container .hiding-container .expand-container::-webkit-scrollbar-thumb { + background: #FF0000; +} + +.question-container .hiding-container .expand-container.with-media { + /* padding-left: 18%; */ +} + +.question-container .hiding-container .expand-container p { + margin-top: 0; +} + +.question-container .expand-button { + position: absolute; + width: 9%; + border-radius: 9px; + height: 21.8%; + bottom: 5%; + right: 0; + z-index: 2; + cursor: pointer; + display: none; +} + +.question-container .expand-button img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + height: 70%; +} + +.question-container .expand-button img.flip { + transform: rotate(180deg); +} + +.question-zoom-img { + width: 50%; + max-width: 35px; + position: absolute; + bottom: 0%; + right: 0%; + cursor: pointer; +} + +.bg-graphics { + position: absolute; + left:0; + top:0; + width: 100%; + height: 100%; +} + +.left2{ + left: 2%; +} + +.bg-graphics .bg-circle { + position: fixed; + width: 60vw; + height: 106.6662vh; + border-radius: 50%; + opacity: 0.15; + background-color: #ffffff; +} + +.bg-graphics .bg-circle.circle-left { + left: -20vw; + top: 0vh; +} + +.bg-graphics .bg-circle.circle-right { + right: -20vw; + top: 30vh; +} + +.bg-graphics-2 { + position: relative; + overflow: auto; + height: 100%; +} +.bg-graphics-2 .bg-circle.circle-left { + left: -20vw; + top: 0vh; +} + +.bg-graphics-2 .bg-circle.circle-right { + right: -20vw; + top: 30vh; +} + +.bg-graphics-2 .bg-circle { + position: fixed; + width: 60vw; + height: 106.6662vh; + border-radius: 50%; + opacity: 0.15; + background-color: #ffffff; +} + +.plugin-content-container em { + font-style: italic; +} + +.urdu-text{ + font-family: NotoNastaliqUrdu; + font-size: 12px; + padding: 3px; + line-height: 1.95em +} + +/* QUESTION COMPONENT BIG START */ +.question-container-big .text-image-container .image-container .qimage, .question-container-big .text-image-container .expand-button img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; +} + +.question-container-big { + height: 50%; + background: white; +} +.imagegrid-mcq-question-head{ + height: 100%; +} +.imagegrid-mcq-question-head .question-container-big { + height: 100%; +} + +.question-container-big .expand-button img.flip { + transform: rotate(180deg); +} + +.question-container-big .text-image-container { + width: 80%; + margin-left: 10%; + height: 100%; + float: left; + position: relative; +} + +.question-container-big .text-image-container .hiding-container { + line-height: 1.4em; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; + padding-bottom: 30px; + /* width */ + /* Track */ + /* Handle */ + background:white; + padding: 1.5% 5% 0% 5%; + height: 35.7%; + position: absolute; + overflow: hidden; + z-index: 2; +} + +.question-container-big .text-image-container .hiding-container ::-webkit-scrollbar { + width: 5px; +} + +.question-container-big .text-image-container .hiding-container ::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px #80808052; + border-radius: 10px; + background: #f1f1f100; +} + +.question-container-big .text-image-container .hiding-container ::-webkit-scrollbar-thumb { + background: #8080804a; + border-radius: 10px; + max-height: 30px; +} + +.question-container-big .text-image-container .hiding-container .expand-container { + text-align: left; + max-height: 41vh; + z-index: 2; + background: white; + margin-bottom: 8vh; +} + +.question-container-big.no-qimage .text-image-container .hiding-container .expand-container { + max-height:56vh; + z-index: 2; + background: white; + margin-bottom: 8vh; +} + +.question-container-big .text-image-container .expand-button { + position: absolute; + bottom: 10%; + right: 7%; + z-index: 2; + cursor: pointer; + display:none; +} + +.question-container-big .text-image-container .expand-button img { + height: 4vh; +} + +.question-container-big .text-image-container .image-container { + height: 58%; + background: #EEEEEE; + position: relative; + margin-top: 13.3%; + border-radius: 10px; +} + +.question-container-big .text-image-container .hiding-container { + background:white; +} + +.question-container-big .text-image-container .image-container .qimage { + max-width: 100%; + max-height: 100%; +} + +.question-container-big .text-image-container .image-container .zoom-icon { + position: absolute; + bottom: 0; + right: 0; + width: 50%; + max-width: 32px; +} + +.question-container-big .text-image-container .image-container.no-text { + height: 85%; + margin-top: 3vh; + z-index: 3; +} + +.question-container-big .audio-container { + width: 10%; + height: 100%; + float: left; + position: relative; +} + +.question-container-big .audio-container img { + position: absolute; + width: 60%; + float: left; + left: 20%; + top: 7%; +} + +.no-qimage .text-image-container .hiding-container { + height: 89%; +} \ No newline at end of file diff --git a/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/js/components.js b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/js/components.js new file mode 100644 index 000000000..024e7f1c3 --- /dev/null +++ b/player/public/fixture-stories/CBSE_MCQ/widgets/content-plugins/org.ekstep.questionunit-1.1/renderer/components/js/components.js @@ -0,0 +1,131 @@ +org.ekstep.questionunit = org.ekstep.questionunit || {}; +org.ekstep.questionunit.baseComponent = { + playAudio: function (audioObj) { + EkstepRendererAPI.dispatchEvent('org.ekstep.questionunit:playaudio', audioObj) + }, + loadImageFromUrl: function (element, imgUrl, pluginId, pluginVer) { + EkstepRendererAPI.dispatchEvent('org.ekstep.questionunit:loadimagefromurl', { + 'element': element, + 'path': imgUrl, + 'pluginId': pluginId, + 'pluginVer': pluginVer + }); + }, + loadAssetUrl: function (element, imgUrl, pluginId, pluginVer) { + EkstepRendererAPI.dispatchEvent('org.ekstep.questionunit:loadAssetUrl', { + 'element': element, + 'path': imgUrl, + 'pluginId': pluginId, + 'pluginVer': pluginVer + }); + }, + generateModelTemplate: function () { + return "