Skip to content

Commit

Permalink
fixup! fixup! test: test debug msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenk committed Dec 19, 2024
1 parent 66a9b21 commit 2a15045
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
8 changes: 8 additions & 0 deletions openassessment/xblock/static/js/spec/lms/oa_peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,21 @@ describe("OpenAssessment.PeerView", function() {

// Turing this off for now because it's flaky
xit("warns of unsubmitted assessments", function() {
console.log("Test1")
const view = createPeerAssessmentView('oa_peer_assessment.html');
console.log("Test2")

expect(view.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test3")

// Click on radio buttons, to create unsubmitted changes.
$('.question__answers', view.element).each(function() {
$('input[type="radio"]', this).first().click();
});
console.log("Test4")

expect(view.baseView.unsavedWarningEnabled()).toBe(true);
console.log("Test5")

// When submitPeerAssessment is executed, the views will all re-render. However,
// as the test does not mock out the surrounding elements, the re-render
Expand All @@ -165,10 +170,13 @@ describe("OpenAssessment.PeerView", function() {
}
).promise();
};
console.log("Test6")

submitPeerAssessment(view);
console.log("Test7")

expect(view.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test8")
});

describe("Turbo Mode", function() {
Expand Down
11 changes: 9 additions & 2 deletions openassessment/xblock/static/js/spec/lms/oa_self.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,18 @@ describe("OpenAssessment.SelfView", function() {
});

it("warns of unsubmitted assessments", function() {

console.log("Test1")
expect(view.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test2")

// Click on radio buttons, to create unsubmitted changes.
console.log("Test3")
$('.question__answers', view.el).each(function() {
$('input[type="radio"]', this).first().click();
});

console.log("Test4")
expect(view.baseView.unsavedWarningEnabled()).toBe(true);
console.log("Test5")

// When selfAssess is executed, the views will all re-render. However,
// as the test does not mock out the surrounding elements, the re-render
Expand All @@ -123,9 +126,13 @@ describe("OpenAssessment.SelfView", function() {
}
).promise();
};
console.log("Test6")

view.selfAssess();
console.log("Test7")

expect(view.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test8")

});
});
10 changes: 10 additions & 0 deletions openassessment/xblock/static/js/spec/lms/oa_staff_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,23 +648,33 @@ describe('OpenAssessment.StaffAreaView', function() {
});

it('warns of unsubmitted assessments', function() {
console.log("Test1")
var staffArea = createStaffArea(),
$assessment;
console.log("Test2")

chooseStudent(staffArea, 'testStudent');
console.log("Test3")

expect(staffArea.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test4")

// Fill in and submit the assessment
$assessment = getAssessment(staffArea, staffAreaTab);
console.log("Test5")
fillAssessment($assessment, gradingType);
console.log("Test6")

expect(staffArea.baseView.unsavedWarningEnabled()).toBe(true);
console.log("Test7")

server.studentTemplate = 'oa_staff_graded_submission.html';
console.log("Test8")
submitAssessment(staffArea, staffAreaTab);
console.log("Test9")

expect(staffArea.baseView.unsavedWarningEnabled()).toBe(false);
console.log("Test10")
});
});
});
Expand Down

0 comments on commit 2a15045

Please sign in to comment.