feat: AA-883 basic prototype for custom pacing pls in studio
fix: make new field in xblock json serializable and don't assign due dates to ORAs feat: display warning message in Studio if the relative date input is more than 18 weeks for custom pacing in self paced course fix: handle due dates for mix of ORA and non ORA problems under a subsection and other styling fixes feat: add a minimum restriction for self paced courses due date editor input fix: naming of warning id divs to be more specific and exclude children of ORA problems in setting due dates test: extracting dates for a self paced course with custom pacing test: frontend for self paced custom pacing modal in studio and clean up its backend tests fix: remove an unused line when getting children of custom pacing subsection, reorganize testing for custom pacing fix: more specific comments to testing for custom PLS and remove a test case course fix: more cleanup for self paced custom pacing PLS backend tests
This commit is contained in:
@@ -12,7 +12,7 @@ describe('CourseOutlinePage', function() {
|
||||
var createCourseOutlinePage, displayNameInput, model, outlinePage, requests, getItemsOfType, getItemHeaders,
|
||||
verifyItemsExpanded, expandItemsAndVerifyState, collapseItemsAndVerifyState, selectBasicSettings,
|
||||
selectVisibilitySettings, selectAdvancedSettings, createMockCourseJSON, createMockSectionJSON,
|
||||
createMockSubsectionJSON, verifyTypePublishable, mockCourseJSON, mockEmptyCourseJSON, setSelfPaced,
|
||||
createMockSubsectionJSON, verifyTypePublishable, mockCourseJSON, mockEmptyCourseJSON, setSelfPaced,setSelfPacedCustomPLS,
|
||||
mockSingleSectionCourseJSON, createMockVerticalJSON, createMockIndexJSON, mockCourseEntranceExamJSON,
|
||||
selectOnboardingExam, createMockCourseJSONWithReviewRules,mockCourseJSONWithReviewRules,
|
||||
mockOutlinePage = readFixtures('templates/mock/mock-course-outline-page.underscore'),
|
||||
@@ -202,6 +202,11 @@ describe('CourseOutlinePage', function() {
|
||||
course.set('self_paced', true);
|
||||
};
|
||||
|
||||
setSelfPacedCustomPLS = function() {
|
||||
setSelfPaced();
|
||||
course.set('is_custom_pls_active', true);
|
||||
}
|
||||
|
||||
createCourseOutlinePage = function(test, courseJSON, createOnly) {
|
||||
requests = AjaxHelpers.requests(test);
|
||||
model = new XBlockOutlineInfo(courseJSON, {parse: true});
|
||||
@@ -1002,9 +1007,9 @@ describe('CourseOutlinePage', function() {
|
||||
});
|
||||
|
||||
describe('Subsection', function() {
|
||||
var getDisplayNameWrapper, setEditModalValues, setContentVisibility, mockServerValuesJson,
|
||||
selectDisableSpecialExams, selectTimedExam, selectProctoredExam, selectPracticeExam,
|
||||
selectPrerequisite, selectLastPrerequisiteSubsection, checkOptionFieldVisibility,
|
||||
var getDisplayNameWrapper, setEditModalValues, setEditModalValuesForCustomPacing, setContentVisibility, mockServerValuesJson,
|
||||
mockCustomPacingServerValuesJson, selectDisableSpecialExams, selectTimedExam, selectProctoredExam, selectPracticeExam,
|
||||
selectPrerequisite, selectLastPrerequisiteSubsection, selectDueNumWeeksSubsection, checkOptionFieldVisibility,
|
||||
defaultModalSettings, modalSettingsWithExamReviewRules, getMockNoPrereqOrExamsCourseJSON, expectShowCorrectness;
|
||||
|
||||
getDisplayNameWrapper = function() {
|
||||
@@ -2117,6 +2122,170 @@ describe('CourseOutlinePage', function() {
|
||||
);
|
||||
expect($modalWindow.find('.outline-subsection')).not.toExist();
|
||||
});
|
||||
|
||||
describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function () {
|
||||
beforeEach(function() {
|
||||
var mockCourseJSON = createMockCourseJSON({}, [
|
||||
createMockSectionJSON({}, [
|
||||
createMockSubsectionJSON({}, [])
|
||||
])
|
||||
]);
|
||||
createCourseOutlinePage(this, mockCourseJSON, false);
|
||||
setSelfPacedCustomPLS();
|
||||
});
|
||||
|
||||
setEditModalValuesForCustomPacing = function(due_in, grading_type) {
|
||||
$('#due_in').val(due_in);
|
||||
$('#grading_type').val(grading_type);
|
||||
};
|
||||
|
||||
selectDueNumWeeksSubsection = function(weeks) {
|
||||
$('#due_in').val(weeks).trigger('keyup');
|
||||
}
|
||||
|
||||
mockCustomPacingServerValuesJson = createMockSectionJSON({
|
||||
release_date: 'Jan 01, 2970 at 05:00 UTC'
|
||||
}, [
|
||||
createMockSubsectionJSON({
|
||||
graded: true,
|
||||
due_num_weeks: 3,
|
||||
format: 'Lab',
|
||||
has_explicit_staff_lock: true,
|
||||
staff_only_message: true,
|
||||
is_prereq: false,
|
||||
show_correctness: 'never',
|
||||
is_time_limited: false,
|
||||
is_practice_exam: false,
|
||||
is_proctored_exam: false,
|
||||
default_time_limit_minutes: null,
|
||||
}, [
|
||||
createMockVerticalJSON({
|
||||
has_changes: true,
|
||||
published: false
|
||||
})
|
||||
])
|
||||
]);
|
||||
|
||||
it('can show correct editors for self_paced course with custom pacing', function (){
|
||||
outlinePage.$('.outline-subsection .configure-button').click();
|
||||
expect($('.edit-settings-release').length).toBe(0);
|
||||
// Due date input exists for custom pacing self paced courses
|
||||
expect($('.grading-due-date').length).toBe(1);
|
||||
expect($('.edit-settings-grading').length).toBe(1);
|
||||
expect($('.edit-content-visibility').length).toBe(1);
|
||||
expect($('.edit-show-correctness').length).toBe(1);
|
||||
});
|
||||
|
||||
it('can be edited when custom pacing for self paced course is active', function() {
|
||||
outlinePage.$('.outline-subsection .configure-button').click();
|
||||
setEditModalValuesForCustomPacing('3', 'Lab');
|
||||
selectAdvancedSettings();
|
||||
$('.wrapper-modal-window .action-save').click();
|
||||
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/mock-subsection', {
|
||||
graderType: 'Lab',
|
||||
isPrereq: false,
|
||||
metadata: {
|
||||
due_num_weeks: 3,
|
||||
is_time_limited: false,
|
||||
is_practice_exam: false,
|
||||
is_proctored_enabled: false,
|
||||
default_time_limit_minutes: null,
|
||||
is_onboarding_exam: false,
|
||||
}
|
||||
});
|
||||
expect(requests[0].requestHeaders['X-HTTP-Method-Override']).toBe('PATCH');
|
||||
AjaxHelpers.respondWithJson(requests, {});
|
||||
|
||||
AjaxHelpers.expectJsonRequest(requests, 'GET', '/xblock/outline/mock-section');
|
||||
AjaxHelpers.respondWithJson(requests, mockCustomPacingServerValuesJson);
|
||||
AjaxHelpers.expectNoRequests(requests);
|
||||
|
||||
expect($('.outline-subsection .status-grading-value')).toContainText(
|
||||
'Lab'
|
||||
);
|
||||
expect($('.outline-subsection .status-message-copy')).toContainText(
|
||||
'Contains staff only content'
|
||||
);
|
||||
|
||||
expect($('.outline-item .outline-subsection .status-grading-value')).toContainText('Lab');
|
||||
outlinePage.$('.outline-item .outline-subsection .configure-button').click();
|
||||
expect($('#due_in').val()).toBe('3');
|
||||
expect($('#grading_type').val()).toBe('Lab');
|
||||
expect($('input[name=content-visibility][value=staff_only]').is(':checked')).toBe(true);
|
||||
expect($('input.timed_exam').is(':checked')).toBe(false);
|
||||
expect($('input.proctored_exam').is(':checked')).toBe(false);
|
||||
expect($('input.no_special_exam').is(':checked')).toBe(true);
|
||||
expect($('input.practice_exam').is(':checked')).toBe(false);
|
||||
expectShowCorrectness('never');
|
||||
});
|
||||
|
||||
it('shows validation error on due number of weeks', function() {
|
||||
outlinePage.$('.outline-subsection .configure-button').click();
|
||||
|
||||
// when due number of weeks goes over 18
|
||||
selectDueNumWeeksSubsection('19');
|
||||
expect($('#due-num-weeks-warning-max').css('display')).not.toBe('none');
|
||||
expect($('.wrapper-modal-window .action-save').prop('disabled')).toBe(true);
|
||||
expect($('.wrapper-modal-window .action-save').hasClass('is-disabled')).toBe(true);
|
||||
|
||||
// when due number of weeks is less than 1
|
||||
selectDueNumWeeksSubsection('-1');
|
||||
expect($('#due-num-weeks-warning-min').css('display')).not.toBe('none');
|
||||
expect($('.wrapper-modal-window .action-save').prop('disabled')).toBe(true);
|
||||
expect($('.wrapper-modal-window .action-save').hasClass('is-disabled')).toBe(true);
|
||||
|
||||
// when no validation error should show up
|
||||
selectDueNumWeeksSubsection('10');
|
||||
expect($('#due-num-weeks-warning-max').css('display')).toBe('none');
|
||||
expect($('#due-num-weeks-warning-min').css('display')).toBe('none');
|
||||
expect($('.wrapper-modal-window .action-save').prop('disabled')).toBe(false);
|
||||
expect($('.wrapper-modal-window .action-save').hasClass('is-disabled')).toBe(false);
|
||||
});
|
||||
|
||||
it('due num weeks (due_in) can be cleared.', function() {
|
||||
outlinePage.$('.outline-item .outline-subsection .configure-button').click();
|
||||
setEditModalValuesForCustomPacing('3', 'Lab');
|
||||
setContentVisibility('staff_only');
|
||||
$('.wrapper-modal-window .action-save').click();
|
||||
|
||||
// This is the response for the change operation.
|
||||
AjaxHelpers.respondWithJson(requests, {});
|
||||
// This is the response for the subsequent fetch operation.
|
||||
AjaxHelpers.respondWithJson(requests, mockCustomPacingServerValuesJson);
|
||||
|
||||
expect($('.outline-subsection .status-grading-value')).toContainText(
|
||||
'Lab'
|
||||
);
|
||||
expect($('.outline-subsection .status-message-copy')).toContainText(
|
||||
'Contains staff only content'
|
||||
);
|
||||
|
||||
outlinePage.$('.outline-subsection .configure-button').click();
|
||||
expect($('#due_in').val()).toBe('3');
|
||||
expect($('#grading_type').val()).toBe('Lab');
|
||||
expect($('input[name=content-visibility][value=staff_only]').is(':checked')).toBe(true);
|
||||
|
||||
$('.wrapper-modal-window .due-date-input .action-clear').click();
|
||||
expect($('#due_in').val()).toBe('');
|
||||
|
||||
$('#grading_type').val('notgraded');
|
||||
setContentVisibility('visible');
|
||||
|
||||
$('.wrapper-modal-window .action-save').click();
|
||||
|
||||
// This is the response for the change operation.
|
||||
AjaxHelpers.respondWithJson(requests, {});
|
||||
// This is the response for the subsequent fetch operation.
|
||||
AjaxHelpers.respondWithJson(requests,
|
||||
createMockSectionJSON({}, [createMockSubsectionJSON()])
|
||||
);
|
||||
|
||||
expect($('.outline-subsection .status-grading-value')).not.toExist();
|
||||
expect($('.outline-subsection .status-message-copy')).not.toContainText(
|
||||
'Contains staff only content'
|
||||
);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// Note: most tests for units can be found in Bok Choy
|
||||
|
||||
Reference in New Issue
Block a user