@edx/edx-proctoring
Advanced tools
Comparing version 3.7.6 to 3.7.7
@@ -91,2 +91,3 @@ edx = edx || {}; | ||
searchAttempts: function(event) { | ||
var $searchIcon, $spinner; | ||
var searchText = $('#search_attempt_id').val(); | ||
@@ -97,2 +98,6 @@ if (searchText !== '') { | ||
this.collection.url = this.initial_url + this.course_id + '/search/' + searchText; | ||
$searchIcon = $(document.getElementById('attempt-search-indicator')); | ||
$searchIcon.addClass('hidden'); | ||
$spinner = $(document.getElementById('attempt-loading-indicator')); | ||
$spinner.removeClass('hidden'); | ||
this.hydrate(); | ||
@@ -152,3 +157,8 @@ event.stopPropagation(); | ||
success: function() { | ||
var $searchIcon, $spinner; | ||
self.render(); | ||
$spinner = $(document.getElementById('attempt-loading-indicator')); | ||
$spinner.addClass('hidden'); | ||
$searchIcon = $(document.getElementById('attempt-search-indicator')); | ||
$searchIcon.removeClass('hidden'); | ||
} | ||
@@ -155,0 +165,0 @@ }); |
@@ -75,2 +75,3 @@ edx = edx || {}; | ||
searchItems: function(event) { | ||
var $searchIcon, $spinner; | ||
var searchText = $('#search_onboarding_id').val(); | ||
@@ -82,2 +83,6 @@ if (searchText !== '') { | ||
this.collection.url = this.constructUrl(); | ||
$searchIcon = $(document.getElementById('onboarding-search-indicator')); | ||
$searchIcon.addClass('hidden'); | ||
$spinner = $(document.getElementById('onboarding-loading-indicator')); | ||
$spinner.removeClass('hidden'); | ||
this.hydrate(); | ||
@@ -169,3 +174,8 @@ event.stopPropagation(); | ||
success: function() { | ||
var $searchIcon, $spinner; | ||
self.render(); | ||
$spinner = $(document.getElementById('onboarding-loading-indicator')); | ||
$spinner.addClass('hidden'); | ||
$searchIcon = $(document.getElementById('onboarding-search-indicator')); | ||
$searchIcon.removeClass('hidden'); | ||
}, | ||
@@ -175,3 +185,8 @@ error: function() { | ||
// still want the view to render | ||
var $searchIcon, $spinner; | ||
self.render(); | ||
$spinner = $(document.getElementById('onboarding-loading-indicator')); | ||
$spinner.addClass('hidden'); | ||
$searchIcon = $(document.getElementById('onboarding-search-indicator')); | ||
$searchIcon.removeClass('hidden'); | ||
} | ||
@@ -178,0 +193,0 @@ }); |
@@ -181,4 +181,12 @@ describe('ProctoredExamAttemptView', function() { | ||
'<input type="text" id="search_attempt_id" placeholder="e.g johndoe or john.doe@gmail.com"' + | ||
'<% if (inSearchMode) { %> value="<%= searchText %>" <%} %>' + | ||
'/> <span class="search"><span class="icon fa fa-search" aria-hidden="true"></span></span> ' + | ||
'<% if (inSearchMode) { %> value="<%= searchText %>" <%} %> /> ' + | ||
'<span class="search">' + | ||
'<span class="icon fa fa-search" id="attempt-search-indicator" aria-hidden="true"></span>' + | ||
'<div aria-live="polite" aria-relevant="all">' + | ||
'<div id="attempt-loading-indicator" class="hidden">' + | ||
'<span class="icon fa fa-spinner fa-pulse" aria-hidden="true"></span>' + | ||
'<span class="sr"><%- gettext("Loading") %></span>' + | ||
'</div>' + | ||
'</div>' + | ||
'</span>' + | ||
'<span class="clear-search"><span class="icon fa fa-remove" aria-hidden="true"></span></span>' + | ||
@@ -272,4 +280,12 @@ '</div>' + | ||
'<input type="text" id="search_attempt_id" placeholder="e.g johndoe or john.doe@gmail.com"' + | ||
'<% if (inSearchMode) { %> value="<%= searchText %>" <%} %>' + | ||
'/> <span class="search"><span class="icon fa fa-search" aria-hidden="true"></span></span> ' + | ||
'<% if (inSearchMode) { %> value="<%= searchText %>" <%} %> /> ' + | ||
'<span class="search">' + | ||
'<span class="icon fa fa-search" id="attempt-search-indicator" aria-hidden="true"></span>' + | ||
'<div aria-live="polite" aria-relevant="all">' + | ||
'<div id="attempt-loading-indicator" class="hidden">' + | ||
'<span class="icon fa fa-spinner fa-pulse" aria-hidden="true"></span>' + | ||
'<span class="sr"><%- gettext("Loading") %></span>' + | ||
'</div>' + | ||
'</div>' + | ||
'</span>' + | ||
'<span class="clear-search"><span class="icon fa fa-remove" aria-hidden="true"></span></span>' + | ||
@@ -523,2 +539,6 @@ '</div>' + | ||
expect(this.proctored_exam_attempt_view.$el.find('tr.allowance-items').html()).toContain('Normal Exam'); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
@@ -544,2 +564,8 @@ $('#search_attempt_id').val(searchText); | ||
// check that spinner is visible | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
// process the search attempt requests. | ||
@@ -551,3 +577,9 @@ this.server.respond(); | ||
expect(this.proctored_exam_attempt_view.$el.find('tr.allowance-items').html()).toContain('Normal Exam'); | ||
// check that spinner is hidden again | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
}); | ||
it('should clear the search for the proctored exam attempt', function() { | ||
@@ -868,2 +900,62 @@ var searchText = 'invalid_search_text'; | ||
}); | ||
it('searches and shows spinner for grouped attempts', function() { | ||
var searchText = 'testuser1'; | ||
setFixtures('<div class="student-proctored-exam-container" data-course-id="test_course_id" ' + | ||
'data-enable-exam-resume-proctoring-improvements="True"></div>'); | ||
this.server.respondWith('GET', '/api/edx_proctoring/v1/proctored_exam/attempt/grouped/course_id/test_course_id', | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(getExpectedGroupedProctoredExamAttemptWithAttemptStatusJson('submitted', false)) | ||
] | ||
); | ||
this.proctored_exam_attempt_view = new edx.instructor_dashboard.proctoring.ProctoredExamAttemptView(); | ||
// Process all requests so far | ||
this.server.respond(); | ||
this.server.respond(); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
$('#search_attempt_id').val(searchText); | ||
// search for the proctored exam attempt | ||
this.server.respondWith( | ||
'GET', | ||
'/api/edx_proctoring/v1/proctored_exam/attempt/grouped/course_id/test_course_id/search/' + searchText, | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(getExpectedGroupedProctoredExamAttemptWithAttemptStatusJson('started')) | ||
] | ||
); | ||
// trigger the search attempt event. | ||
spyOnEvent('.search-attempts > span.search', 'click'); | ||
$('.search-attempts > span.search').trigger('click'); | ||
// check that spinner is visible | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
// process the search attempt requests. | ||
this.server.respond(); | ||
// check that spinner is hidden again | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_attempt_view.$el.find('#attempt-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
}); | ||
}); |
@@ -53,3 +53,11 @@ describe('ProctoredExamOnboardingView', function() { | ||
'/>' + | ||
'<span class="search"><span class="icon fa fa-search" aria-hidden="true"></span></span>' + | ||
'<span class="search">' + | ||
'<span class="icon fa fa-search" id="onboarding-search-indicator" aria-hidden="true"></span>' + | ||
'<div aria-live="polite" aria-relevant="all">' + | ||
'<div id="onboarding-loading-indicator" class="hidden">' + | ||
'<span class="icon fa fa-spinner fa-pulse" aria-hidden="true"></span>' + | ||
'<span class="sr"><%- gettext("Loading") %></span>' + | ||
'</div>' + | ||
'</div>' + | ||
'</span>' + | ||
'<span class="clear-search"><span class="icon fa fa-remove" aria-hidden="true"></span></span>' + | ||
@@ -270,2 +278,65 @@ '</div>' + | ||
}); | ||
it('should search for onboarding attempts', function() { | ||
var searchText = 'badSearch'; | ||
this.server.respondWith('GET', '/api/edx_proctoring/v1/user_onboarding/status/course_id/test_course_id', | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(expectedOnboardingDataJson) | ||
] | ||
); | ||
this.proctored_exam_onboarding_view = new edx.instructor_dashboard.proctoring.ProctoredExamOnboardingView(); | ||
// Process all requests so far | ||
this.server.respond(); | ||
this.server.respond(); | ||
expect(this.proctored_exam_onboarding_view.$el.find('.onboarding-items').html()) | ||
.toContain('testuser1'); | ||
expect(this.proctored_exam_onboarding_view.$el.find('.onboarding-items').html()) | ||
.toContain('Not Started'); | ||
expect(this.proctored_exam_onboarding_view.$el.find('.onboarding-items').html()) | ||
.toContain('---'); | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
$('#search_onboarding_id').val(searchText); | ||
// search for the proctored exam attempt | ||
this.server.respondWith( | ||
'GET', | ||
'/api/edx_proctoring/v1/user_onboarding/status/course_id/test_course_id?text_search=' + searchText, | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(noDataJson) | ||
] | ||
); | ||
// trigger the search attempt event. | ||
spyOnEvent('.search-onboarding > span.search', 'click'); | ||
$('.search-onboarding > span.search').trigger('click'); | ||
// check that spinner is visible | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-search-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-loading-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
// process the search attempt requests. | ||
this.server.respond(); | ||
// check that spinner is hidden again | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-search-indicator').hasClass('hidden')) | ||
.toEqual(false); | ||
expect(this.proctored_exam_onboarding_view.$el.find('#onboarding-loading-indicator').hasClass('hidden')) | ||
.toEqual(true); | ||
}); | ||
}); |
@@ -5,3 +5,3 @@ { | ||
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.", | ||
"version": "3.7.6", | ||
"version": "3.7.7", | ||
"main": "edx_proctoring/static/index.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
989892
18179