Skip to content

Commit

Permalink
Merge branch 'release-6.1.0' of https://github.com/Sunbird-inQuiry/ed…
Browse files Browse the repository at this point in the history
…itor into release-6.1.0
  • Loading branch information
vaibhavbhuva committed Jul 12, 2023
2 parents e100ad7 + bb65e4c commit 5ca8229
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,6 @@
height: 100%;
}
}

.upload-file-section {
display: flex;
height: 240px;
width: 100%;
max-width: 800px;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0 auto;
background-color: #F5F9FC;
border: 1px dashed #80a7ce;
}

.upload-file-section {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class AssetBrowserComponent implements OnInit, OnDestroy {
}
dismissPops(modal) {
this.dismissImagePicker();
if (modal && modal.deny) {
if (modal && modal?.deny) {
modal.deny();
}
}
Expand Down Expand Up @@ -336,7 +336,7 @@ export class AssetBrowserComponent implements OnInit, OnDestroy {
}

ngOnDestroy() {
if (this.modal && this.modal.deny) {
if (this?.modal && this?.modal?.deny) {
this.modal.deny();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,6 @@
}
}

.upload-file-section {
display: flex;
height: 240px;
width: 100%;
max-width: 800px;
align-items: center;
justify-content: center;
flex-direction: column;
margin: 0 auto;
background-color: #F5F9FC;
border: 1px dashed #80a7ce;
}

.qq-uploader.qq-uploader-selector.custom-qq-uploader {
background: inherit;
border-color: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ lib-questionset-editor {
}
.sb-keywordbox {
border: 1px solid rgba(34, 36, 38, 0.15) !important;
padding: 0.45rem 0.5rem !important;
border-radius: 0.28571429rem;
font-size: 0.785rem !important;
font-weight: 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ export const getCategoryDefinitionResponse = {
childrenConfig: {
choice: {}
},
config: {},
config: {
maximumOptions: 4
},
schema: {
properties: {
mimeType: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1219,14 +1219,32 @@ describe('EditorComponent', () => {
expect(editorService.apiErrorHandling).toHaveBeenCalled();
});

it('#handleTemplateSelection should call #redirectToQuestionTab()', async () => {
it('#handleTemplateSelection should call #redirectToQuestionTab() when renderTaxonomy is true', async () => {
const event = 'Multiple Choice Question';
const editorService = TestBed.inject(EditorService);
component.editorConfig = editorConfig;
component.editorConfig.config.renderTaxonomy = true;
component.editorConfig.config.showSourcingStatus = false;
spyOn(component, 'redirectToQuestionTab').and.callFake(() => {});
spyOn(component, 'setLeafFormConfig').and.callFake(() => {});
spyOn(component, 'setEnforceCorrectAnswer').and.callFake(() => {});
spyOn(editorService, 'getCategoryDefinition').and.returnValue(of(getCategoryDefinitionResponse));
component.handleTemplateSelection(event);
expect(component.redirectToQuestionTab).toHaveBeenCalled();
});

it('#handleTemplateSelection should call #redirectToQuestionTab() when renderTaxonomy is false', async () => {
const event = 'Multiple Choice Question';
const editorService = TestBed.inject(EditorService);
component.editorConfig = editorConfig;
component.editorConfig.config.renderTaxonomy = false;
component.editorConfig.config.showSourcingStatus = false;
spyOn(component, 'setLeafFormConfig').and.callFake(() => {});
spyOn(component, 'setEnforceCorrectAnswer').and.callFake(() => {});
spyOn(component, 'redirectToQuestionTab').and.callFake(() => {});
spyOn(editorService, 'getCategoryDefinition').and.returnValue(of(getCategoryDefinitionResponse));
component.handleTemplateSelection(event);
expect(component.questionComponentInput.config).toEqual({});
expect(component.redirectToQuestionTab).toHaveBeenCalled();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,11 @@ export class EditorComponent implements OnInit, OnDestroy, AfterViewInit {
}

const catMetaData = _.get(selectedtemplateDetails, 'objectMetadata');
!_.isUndefined(this.editorConfig.config.renderTaxonomy) ? (this.questionComponentInput.config ={maximumOptions:_.get(catMetaData, 'config.maximumOptions')}) : '' ;
if (_.get(this.editorConfig, 'config.renderTaxonomy') === true) {
this.questionComponentInput.config = {maximumOptions:_.get(catMetaData, 'config.maximumOptions')};
} else {
this.questionComponentInput.config = {};
}
this.setEnforceCorrectAnswer(catMetaData);
if (_.isEmpty(_.get(catMetaData, 'schema.properties.interactionTypes.items.enum'))) {
this.editorService.selectedChildren = {
Expand Down Expand Up @@ -1021,7 +1025,7 @@ export class EditorComponent implements OnInit, OnDestroy, AfterViewInit {
};
this.pageId = 'question';

if(!_.isUndefined(mode) && !_.isUndefined(this.editorConfig.config.renderTaxonomy)){
if(!_.isUndefined(mode) && _.get(this.editorConfig, 'config.renderTaxonomy') === true){
this.setQuestionInputOnRenderTaxonomy(mode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
}

.ui-fancytree {
padding-right: 0.785rem;
// height: calc(100vh - 126px);
margin: 0;
padding: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ select,

.sb-keywordbox {
border: 1px solid rgba(34, 36, 38, 0.15) !important;
padding: 0.45rem 0.5rem !important;
border-radius: 0.28571429rem;
font-size: 0.785rem !important;
font-weight: 500;
Expand Down Expand Up @@ -122,10 +121,8 @@ label {
ul {
font-size: 12px !important;
margin-bottom: 0.5rem !important;
font-weight: 500;
color: #333;
padding: 0;
margin: 0 !important;
opacity: 1 !important;
font-weight: 500 !important;
position: inherit !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('MetaFormComponent', () => {
component.appIcon = 'https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11320764935163904015/artifact/2020101299.png';
component.showAppIcon = true;
const event = {
instances: 'Add Student',
instance: 'Add Student',
appIcon: 'https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11320764935163904015/artifact/2020101299.png',
allowECM : 'No',
levels : ['good', 'bad', 'average'],
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('MetaFormComponent', () => {
component.appIcon = 'https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11320764935163904015/artifact/2020101299.png';
component.showAppIcon = true;
const event = {
instances: 'Add Student',
instance: 'Add Student',
appIcon: 'https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content/do_11320764935163904015/artifact/2020101299.png',
shuffle: true
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,9 @@ export class MetaFormComponent implements OnChanges, OnDestroy {
levels: this.createLeavels(event.levels)
};
}
// tslint:disable-next-line:no-unused-expression
event?.instance ? data.instances = { label : event?.instances } : '';
if (event?.instance) {
data.instances = { label : event?.instances }
}
if (!_.isEmpty(this.appIcon) && this.showAppIcon) {
data.appIcon = this.appIcon;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ sui-select {
}
.sb-keywordbox{
border: 1px solid rgba(34,36,38,.15) !important;
padding: .45rem .5rem!important;
border-radius: .28571429rem;
font-size: 0.785rem !important;
font-weight: 500;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output, AfterViewInit, ViewEncapsulation, OnChanges, OnDestroy } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, AfterViewInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import * as _ from 'lodash-es';
import { v4 as uuidv4 } from 'uuid';
import { McqForm } from '../../interfaces/McqForm';
Expand Down Expand Up @@ -806,7 +806,9 @@ export class QuestionComponent implements OnInit, AfterViewInit, OnDestroy {
metadata.body = metadata.question;
if (!_.isUndefined(this.editorService?.editorConfig?.config?.renderTaxonomy)) {
const treeNodeData = _.get(this.treeNodeData, 'data.metadata');
_.get(treeNodeData,'allowScoring') === 'Yes' ? '' : _.set(metadata,'responseDeclaration.response1.mapping',[]);
if (_.get(treeNodeData,'allowScoring') != 'Yes') {
_.set(metadata,'responseDeclaration.response1.mapping',[]);
}
}

metadata = this.setQuestionProperties(metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
top: 8px;
margin: 0;
width: 20px;
font-size: 18px;
color: #00c786;
font-size: 20px;
}
Expand Down
4 changes: 4 additions & 0 deletions web-component-examples/vanilla-js/styles.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions web-component/styles.css

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion web-component/sunbird-questionset-editor.js

Large diffs are not rendered by default.

0 comments on commit 5ca8229

Please sign in to comment.