Commit f5234b1a by vkaracic

TNL-394: Additional testing

This is an additional test for:
https://openedx.atlassian.net/browse/TNL-394
to test if the get_user function escapes values correctly.
parent ae0e21b3
...@@ -6,6 +6,9 @@ define(['backbone', 'jquery', 'js/staff_debug_actions'], ...@@ -6,6 +6,9 @@ define(['backbone', 'jquery', 'js/staff_debug_actions'],
var locationName = 'test_loc'; var locationName = 'test_loc';
var fixture_id = 'sd_fu_' + locationName; var fixture_id = 'sd_fu_' + locationName;
var fixture = $('<input>', { id: fixture_id, placeholder: "userman" }); var fixture = $('<input>', { id: fixture_id, placeholder: "userman" });
var escapableLocationName = 'test\.\*\+\?\^\:\$\{\}\(\)\|\]\[loc';
var escapableFixture_id = 'sd_fu_' + escapableLocationName;
var escapableFixture = $('<input>', {id: escapableFixture_id, placeholder: "userman"});
describe('get_url ', function () { describe('get_url ', function () {
it('defines url to courseware ajax entry point', function () { it('defines url to courseware ajax entry point', function () {
...@@ -35,6 +38,11 @@ define(['backbone', 'jquery', 'js/staff_debug_actions'], ...@@ -35,6 +38,11 @@ define(['backbone', 'jquery', 'js/staff_debug_actions'],
$('#' + fixture_id).val(''); $('#' + fixture_id).val('');
$('#' + fixture_id).remove(); $('#' + fixture_id).remove();
}); });
it('gets the placeholder name if the id has escapable characters', function() {
$('body').append(escapableFixture);
expect(StaffDebug.get_user('test.*+?^:${}()|][loc')).toBe('userman');
$('#' + escapableFixture_id).remove();
});
}); });
describe('reset', function () { describe('reset', function () {
it('makes an ajax call with the expected parameters', function () { it('makes an ajax call with the expected parameters', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment