@edx/edx-proctoring
Advanced tools
Comparing version 3.23.7 to 3.23.8
@@ -129,4 +129,7 @@ edx = edx || {}; | ||
if (this.template !== null) { | ||
html = this.template({proctored_exam_allowances: this.collection.toJSON()[0], | ||
allowance_types: self.allowance_types}); | ||
html = this.template({ | ||
proctored_exam_allowances: this.collection.toJSON()[0], | ||
allowance_types: self.allowance_types, | ||
generateDomId: self.generateDomId | ||
}); | ||
this.$el.html(html); | ||
@@ -183,3 +186,3 @@ } | ||
$toggleChevron = $(accordionRow).find('.fa-chevron-down'); | ||
$contentPanel = $('#' + accordionRow.innerText.trim()); | ||
$contentPanel = $('#' + accordionRow.getAttribute('data-key-id').trim()); | ||
$contentPanel.show(); | ||
@@ -190,3 +193,3 @@ $toggleChevron.addClass('fa-rotate-180'); | ||
$toggleChevron = $(accordionRow).find('.fa-chevron-down'); | ||
$contentPanel = $('#' + accordionRow.innerText.trim()); | ||
$contentPanel = $('#' + accordionRow.getAttribute('data-key-id').trim()); | ||
$contentPanel.hide(); | ||
@@ -197,2 +200,5 @@ $toggleChevron.removeClass('fa-rotate-180'); | ||
} | ||
}, | ||
generateDomId: function(username) { | ||
return 'ui-id-' + username.replace(/\W/g, ''); | ||
} | ||
@@ -199,0 +205,0 @@ }); |
@@ -32,3 +32,3 @@ describe('ProctoredExamAllowanceView', function() { | ||
// eslint-disable-next-line max-len | ||
html = '<span class="tip"> <%- gettext("Allowances") %>\n <span>\n <a id="add-allowance" href="#" class="add blue-button">+ <%- gettext("Add Allowance") %></a>\n </span>\n</span>\n<% var is_allowances = proctored_exam_allowances.length !== 0 %>\n<% if (is_allowances) { %>\n\n<div class="wrapper-content wrapper">\n <section class="content exam-allowances-content">\n <% _.each(proctored_exam_allowances, function(student){ %>\n <div class="accordion-trigger" aria-expanded="false" style="font-size:20px;">\n <span class="fa fa-chevron-down" aria-hidden="true"></span>\n <%=student[0].user.username %>\n </div>\n <table class="allowance-table" id="<%=student[0].user.username %>" style="display:none;">\n <tbody>\n <tr class="allowance-headings">\n <th class="exam-name"><%- gettext("Exam Name") %></th>\n <th class="email"><%- gettext("Email") %></th>\n <th class="allowance-name"><%- gettext("Allowance Type") %> </th>\n <th class="allowance-value"><%- gettext("Allowance Value") %></th>\n <th class="c_action"><%- gettext("Actions") %> </th>\n </tr>\n <% _.each(student, function(proctored_exam_allowance){ %>\n <% var key = proctored_exam_allowance.key; %>\n <% for (i = 0; i < allowance_types.length; i += 1) { %>\n <% if (key === allowance_types[i][0]) { %>\n <% proctored_exam_allowance.key_display_name = allowance_types[i][1]; %>\n <% break; %>\n <% }} %>\n <% if (!proctored_exam_allowance.key_display_name) { %>\n <% proctored_exam_allowance.key_display_name = key;} %>\n <tr class="allowance-items">\n <td>\n <%- proctored_exam_allowance.proctored_exam.exam_name %>\n </td>\n <td>\n <% if (proctored_exam_allowance.user){ %>\n <%= proctored_exam_allowance.user.email %>\n </td>\n <% }else{ %>\n <td>N/A</td>\n <td>N/A</td>\n <% } %>\n <td>\n <%= proctored_exam_allowance.key_display_name %>\n </td>\n <td>\n <%- proctored_exam_allowance.value %></td>\n <td>\n <a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"\n data-key-name="<%= proctored_exam_allowance.key %>"\n data-key-value="<%= proctored_exam_allowance.key_display_name %>"\n data-user-name="<%= proctored_exam_allowance.user.username %>"\n data-exam-name="<%= proctored_exam_allowance.proctored_exam.exam_name %>"\n class="edit_allowance" href="#">Edit</a>\n <a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"\n data-key-name="<%= proctored_exam_allowance.key %>"\n data-user-id="<%= proctored_exam_allowance.user.id %>"\n class="remove_allowance" href="#">Delete</a>\n </td>\n </tr>\n <% }); %>\n </tbody>\n </table>\n <% }); %>\n </section>\n</div>\n<% } %>\n'; | ||
html = '<span class="tip"> <%- gettext("Allowances") %>\n <span>\n <a id="add-allowance" href="#" class="add blue-button">+ <%- gettext("Add Allowance") %></a>\n </span>\n</span>\n<% var is_allowances = proctored_exam_allowances.length !== 0 %>\n<% if (is_allowances) { %>\n\n<div class="wrapper-content wrapper">\n <section class="content exam-allowances-content">\n <% _.each(proctored_exam_allowances, function(student){ %>\n <div class="accordion-trigger" aria-expanded="false" style="font-size:20px;" data-key-id="<%=generateDomId(student[0].user.username)%>">\n <span class="fa fa-chevron-down" aria-hidden="true"></span>\n <%=student[0].user.username %>\n </div>\n <table class="allowance-table" id="<%=generateDomId(student[0].user.username)%>" style="display:none;">\n <tbody>\n <tr class="allowance-headings">\n <th class="exam-name"><%- gettext("Exam Name") %></th>\n <th class="email"><%- gettext("Email") %></th>\n <th class="allowance-name"><%- gettext("Allowance Type") %> </th>\n <th class="allowance-value"><%- gettext("Allowance Value") %></th>\n <th class="c_action"><%- gettext("Actions") %> </th>\n </tr>\n <% _.each(student, function(proctored_exam_allowance){ %>\n <% var key = proctored_exam_allowance.key; %>\n <% for (i = 0; i < allowance_types.length; i += 1) { %>\n <% if (key === allowance_types[i][0]) { %>\n <% proctored_exam_allowance.key_display_name = allowance_types[i][1]; %>\n <% break; %>\n <% }} %>\n <% if (!proctored_exam_allowance.key_display_name) { %>\n <% proctored_exam_allowance.key_display_name = key;} %>\n <tr class="allowance-items">\n <td>\n <%- proctored_exam_allowance.proctored_exam.exam_name %>\n </td>\n <td>\n <% if (proctored_exam_allowance.user){ %>\n <%= proctored_exam_allowance.user.email %>\n </td>\n <% }else{ %>\n <td>N/A</td>\n <td>N/A</td>\n <% } %>\n <td>\n <%= proctored_exam_allowance.key_display_name %>\n </td>\n <td>\n <%- proctored_exam_allowance.value %></td>\n <td>\n <a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"\n data-key-name="<%= proctored_exam_allowance.key %>"\n data-key-value="<%= proctored_exam_allowance.key_display_name %>"\n data-user-name="<%= proctored_exam_allowance.user.username %>"\n data-exam-name="<%= proctored_exam_allowance.proctored_exam.exam_name %>"\n class="edit_allowance" href="#">Edit</a>\n <a data-exam-id="<%= proctored_exam_allowance.proctored_exam.id %>"\n data-key-name="<%= proctored_exam_allowance.key %>"\n data-user-id="<%= proctored_exam_allowance.user.id %>"\n class="remove_allowance" href="#">Delete</a>\n </td>\n </tr>\n <% }); %>\n </tbody>\n </table>\n <% }); %>\n </section>\n</div>\n<% } %>\n'; | ||
this.server = sinon.fakeServer.create(); | ||
@@ -72,2 +72,21 @@ this.server.autoRespond = true; | ||
}); | ||
it('should toggle the dropdown correctly', function() { | ||
expectedProctoredAllowanceJson[0].testuser1[0].user.username = 'testuser1@test.com'; | ||
this.server.respondWith('GET', '/api/edx_proctoring/v1/proctored_exam/test_course_id/grouped/allowance', | ||
[ | ||
200, | ||
{ | ||
'Content-Type': 'application/json' | ||
}, | ||
JSON.stringify(expectedProctoredAllowanceJson) | ||
] | ||
); | ||
this.proctored_exam_allowance = new edx.instructor_dashboard.proctoring.ProctoredExamAllowanceView(); | ||
this.server.respond(); | ||
this.server.respond(); | ||
$('.accordion-trigger').trigger('click'); | ||
expect($('.accordion-trigger').attr('aria-expanded')).toBe('true'); | ||
}); | ||
}); |
{ | ||
"name": "@edx/edx-proctoring", | ||
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.", | ||
"version": "3.23.7", | ||
"version": "3.23.8", | ||
"main": "edx_proctoring/static/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1013305
18452