diff --git a/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/fixture.html b/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/fixture.html index be90ea04..a428d6c1 100644 --- a/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/fixture.html +++ b/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/fixture.html @@ -81,7 +81,7 @@ -
  • +
  • Enter 'falafel'
    @@ -106,3 +106,77 @@
    + +
    +
    Introduction
    +
      +
    1. +
      +
      +
      Pick 'a'
      +
      +
      + + +
      +
      + + +
      +
      +
      + +
      +
      +
      +
      +
    2. +
    3. +
      +
      +
      Enter 'falafel'
      +
      + +
      +
      + + +
      +
      +
      +
      +
      +
    4. +
    5. +
      +
      +
      Pick 'a'
      +
      +
      + + +
      +
      + + +
      +
      +
      + +
      +
      +
      +
      +
    6. +
    +
    + +
    +
    +
    + diff --git a/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/tests.js b/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/tests.js index 4e218d85..16b29a2a 100644 --- a/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/tests.js +++ b/coursebuilder/tests/unit/javascript_tests/modules_assessment_tags/tests.js @@ -440,6 +440,41 @@ describe('assessment tags', function() { qg.makeReadOnly(); expectDisabled(true, true, true); }); + it('loads the questions in the order they appear on the page', function () { + var el = $('#qg-1'); + var questionData0 = {choices: [ + {score: '1', feedback: 'yes'}, + {score: '0', feedback: 'no'}]}; + var questionData1 = { + hint: 'it\s \'falafel\'', + graders: [{ + matcher: 'case_insensitive', + response: 'falafel', + score: '1.0', + feedback: 'good' + }] + }; + var questionData2 = {choices: [ + {score: '1', feedback: 'yes'}, + {score: '0', feedback: 'no'}]}; + var questionData = { + 'qg-1': { + 'qg-1-mc-0': {'weight': '10'}, + 'qg-1-sa-0': {'weight': '15'}, + 'qg-1-mc-1': {'weight': '20'}, + }, + 'qg-1-mc-0': questionData0, + 'qg-1-sa-0': questionData1, + 'qg-1-mc-1': questionData2 + }; + var qg = new QuestionGroup(el, questionData, MESSAGES); + expect(qg.questions[0] instanceof McQuestion).toBe(true); + expect(qg.questions[1] instanceof SaQuestion).toBe(true); + expect(qg.questions[2] instanceof McQuestion).toBe(true); + expect(qg.questions[0].data).toBe(questionData0); + expect(qg.questions[1].data).toBe(questionData1); + expect(qg.questions[2].data).toBe(questionData2); + }); }); function initTwoQuestions() {