Fix StaffDebug javascript tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
describe('StaffDebugActions', function() {
|
||||
var loc = 'test_loc';
|
||||
var fixture_id = 'sd_fu_' + loc;
|
||||
var location = 'i4x://edX/Open_DemoX/edx_demo_course/problem/test_loc';
|
||||
var locationName = 'test_loc'
|
||||
var fixture_id = 'sd_fu_' + locationName;
|
||||
var fixture = $('<input>', { id: fixture_id, placeholder: "userman" });
|
||||
|
||||
describe('get_url ', function() {
|
||||
@@ -14,13 +15,13 @@ describe('StaffDebugActions', function() {
|
||||
|
||||
it('gets the placeholder username if input field is empty', function() {
|
||||
$('body').append(fixture);
|
||||
expect(StaffDebug.get_user(loc)).toBe('userman');
|
||||
expect(StaffDebug.get_user(locationName)).toBe('userman');
|
||||
$('#' + fixture_id).remove();
|
||||
});
|
||||
it('gets a filled in name if there is one', function() {
|
||||
$('body').append(fixture);
|
||||
$('#' + fixture_id).val('notuserman');
|
||||
expect(StaffDebug.get_user(loc)).toBe('notuserman');
|
||||
expect(StaffDebug.get_user(locationName)).toBe('notuserman');
|
||||
|
||||
$('#' + fixture_id).val('');
|
||||
$('#' + fixture_id).remove();
|
||||
@@ -31,11 +32,11 @@ describe('StaffDebugActions', function() {
|
||||
$('body').append(fixture);
|
||||
|
||||
spyOn($, 'ajax');
|
||||
StaffDebug.reset(loc);
|
||||
StaffDebug.reset(locationName, location);
|
||||
|
||||
expect($.ajax.mostRecentCall.args[0]['type']).toEqual('GET');
|
||||
expect($.ajax.mostRecentCall.args[0]['data']).toEqual({
|
||||
'problem_to_reset': loc,
|
||||
'problem_to_reset': location,
|
||||
'unique_student_identifier': 'userman',
|
||||
'delete_module': false
|
||||
});
|
||||
@@ -50,11 +51,11 @@ describe('StaffDebugActions', function() {
|
||||
$('body').append(fixture);
|
||||
|
||||
spyOn($, 'ajax');
|
||||
StaffDebug.sdelete(loc);
|
||||
StaffDebug.sdelete(locationName, location);
|
||||
|
||||
expect($.ajax.mostRecentCall.args[0]['type']).toEqual('GET');
|
||||
expect($.ajax.mostRecentCall.args[0]['data']).toEqual({
|
||||
'problem_to_reset': loc,
|
||||
'problem_to_reset': location,
|
||||
'unique_student_identifier': 'userman',
|
||||
'delete_module': true
|
||||
});
|
||||
@@ -70,11 +71,11 @@ describe('StaffDebugActions', function() {
|
||||
$('body').append(fixture);
|
||||
|
||||
spyOn($, 'ajax');
|
||||
StaffDebug.rescore(loc);
|
||||
StaffDebug.rescore(locationName, location);
|
||||
|
||||
expect($.ajax.mostRecentCall.args[0]['type']).toEqual('GET');
|
||||
expect($.ajax.mostRecentCall.args[0]['data']).toEqual({
|
||||
'problem_to_reset': loc,
|
||||
'problem_to_reset': location,
|
||||
'unique_student_identifier': 'userman',
|
||||
'delete_module': false
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user