feat(backend): Rendering van meerkeuzevragen en open vragen (essay) toegevoegd + getest
This commit is contained in:
parent
164a547dd1
commit
bc0ac63c92
20 changed files with 126 additions and 16 deletions
|
@ -2,6 +2,7 @@ import {LearningObjectExample} from "../learning-object-example";
|
|||
import {LearningObject} from "../../../../src/entities/content/learning-object.entity";
|
||||
import {Language} from "../../../../src/entities/content/language";
|
||||
import {loadTestAsset} from "../../../test-utils/load-test-asset";
|
||||
import {DwengoContentType} from "../../../../src/services/learning-objects/processing/content-type";
|
||||
|
||||
/**
|
||||
* Create a dummy learning object to be used in tests where multiple learning objects are needed (for example for use
|
||||
|
@ -16,6 +17,7 @@ export function dummyLearningObject(hruid: string, language: Language, title: st
|
|||
learningObject.version = 1;
|
||||
learningObject.title = title;
|
||||
learningObject.description = "Just a dummy learning object for testing purposes";
|
||||
learningObject.contentType = DwengoContentType.TEXT_PLAIN;
|
||||
learningObject.content = Buffer.from("Dummy content");
|
||||
return learningObject;
|
||||
},
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
::MC basic::
|
||||
How are you? {}
|
|
@ -0,0 +1,7 @@
|
|||
<div class="learning-object-gift">
|
||||
<div id="gift-q1" class="gift-question">
|
||||
<h2 id="gift-q1-title" class="gift-title">MC basic</h2>
|
||||
<p id="gift-q1-stem" class="gift-stem">How are you?</p>
|
||||
<textarea id="gift-q1-answer" class="gift-essay-answer"></textarea>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,24 @@
|
|||
import {LearningObjectExample} from "../learning-object-example";
|
||||
import {LearningObject} from "../../../../src/entities/content/learning-object.entity";
|
||||
import {loadTestAsset} from "../../../test-utils/load-test-asset";
|
||||
import {EnvVars, getEnvVar} from "../../../../src/util/envvars";
|
||||
import {Language} from "../../../../src/entities/content/language";
|
||||
import {DwengoContentType} from "../../../../src/services/learning-objects/processing/content-type";
|
||||
|
||||
const example: LearningObjectExample = {
|
||||
createLearningObject: () => {
|
||||
const learningObject = new LearningObject();
|
||||
learningObject.hruid = `${getEnvVar(EnvVars.UserContentPrefix)}test_essay`;
|
||||
learningObject.language = Language.English;
|
||||
learningObject.version = 1;
|
||||
learningObject.title = "Essay question for testing";
|
||||
learningObject.description = "This essay question was only created for testing purposes.";
|
||||
learningObject.contentType = DwengoContentType.GIFT;
|
||||
learningObject.content = loadTestAsset("learning-objects/test-essay/content.txt");
|
||||
return learningObject;
|
||||
},
|
||||
createAttachment: {},
|
||||
getHTMLRendering: () => loadTestAsset("learning-objects/test-essay/rendering.html").toString()
|
||||
};
|
||||
|
||||
export default example;
|
|
@ -0,0 +1,14 @@
|
|||
<div class="learning-object-gift">
|
||||
<div id="gift-q1" class="gift-question">
|
||||
<h2 id="gift-q1-title" class="gift-title">MC basic</h2>
|
||||
<p id="gift-q1-stem" class="gift-stem">Are you following along well with the class?</p>
|
||||
<div class="gift-choice-div">
|
||||
<input value="0" name="gift-q1-choices" id="gift-q1-choice-0" type="radio">
|
||||
<label for="gift-q1-choice-0">[object Object]</label>
|
||||
</div>
|
||||
<div class="gift-choice-div">
|
||||
<input value="1" name="gift-q1-choices" id="gift-q1-choice-1" type="radio">
|
||||
<label for="gift-q1-choice-1">[object Object]</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -3,6 +3,7 @@ import {LearningObject} from "../../../../src/entities/content/learning-object.e
|
|||
import {loadTestAsset} from "../../../test-utils/load-test-asset";
|
||||
import {EnvVars, getEnvVar} from "../../../../src/util/envvars";
|
||||
import {Language} from "../../../../src/entities/content/language";
|
||||
import {DwengoContentType} from "../../../../src/services/learning-objects/processing/content-type";
|
||||
|
||||
const example: LearningObjectExample = {
|
||||
createLearningObject: () => {
|
||||
|
@ -12,6 +13,7 @@ const example: LearningObjectExample = {
|
|||
learningObject.version = 1;
|
||||
learningObject.title = "Multiple choice question for testing";
|
||||
learningObject.description = "This multiple choice question was only created for testing purposes.";
|
||||
learningObject.contentType = DwengoContentType.GIFT;
|
||||
learningObject.content = loadTestAsset("learning-objects/test-multiple-choice/content.txt");
|
||||
return learningObject;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue