commit d529d11f883cc8bffb91ab5856b21c8a2d7991bd
parent 40ed9d49576ab89259f6545274b4479ed8341f2d
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Wed, 24 Mar 2021 08:45:43 -0700
Don't show diff if onMissedPrompt equals 'Tell me'
Diffstat:
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/js/quizzer.js b/js/quizzer.js
@@ -54,7 +54,7 @@ const quizzer = Vue.component("quizzer", {
* @returns {Array} - The diff object
*/
diff: function() {
- if (this.settings.showDiff === "Always" || (this.settings.showDiff === "For single answers" && this.prompt[3].split(",").length === 1)) {
+ if (this.settings.onMissedPrompt === "Correct me" && (this.settings.showDiff === "Always" || (this.settings.showDiff === "For single answers" && this.prompt[3].split(",").length === 1))) {
// Initialize result
let result = {
input: [],
diff --git a/tests/test.quizzer.js b/tests/test.quizzer.js
@@ -595,6 +595,24 @@ describe("Quizzer", function() {
});
});
+ it("Should be plain if onMissedPrompt equals 'Tell me'", function() {
+ // Initialize variables
+ Quizzer.settings.showDiff = "Always";
+ Quizzer.settings.onMissedPrompt = "Tell me";
+ Quizzer.prompts = [["A", "B", "C", "D"]];
+ Quizzer.responce = "E";
+
+ // Assert diff is correct
+ expect(Quizzer.diff).to.deep.equal({
+ input: [ // Should be in original case
+ {changed:false, value:"E"}
+ ],
+ answer: [ // Should be lower case
+ {changed:false, value:"d"}
+ ],
+ });
+ });
+
it("Should be correct if diffs are enabled", function() {
// Initialize variables
Quizzer.settings.showDiff = "Always";