Merge pull request #7104 from edx/shr/bug/AN-4618-Browser-events-are-being-dropped
Add metatag <path_prefix> for pdf_viewer.html
This commit is contained in:
@@ -37,6 +37,74 @@
|
||||
});
|
||||
});
|
||||
|
||||
describe('ajax request settings with path_prefix', function() {
|
||||
var meta_tag;
|
||||
|
||||
beforeEach(function(){
|
||||
this.initialAjaxWithPrefix = jQuery.ajaxWithPrefix;
|
||||
AjaxPrefix.addAjaxPrefix($, _.bind(function () {
|
||||
return $("meta[name='path_prefix']").attr('content');
|
||||
}, this));
|
||||
});
|
||||
|
||||
afterEach(function(){
|
||||
jQuery.ajaxWithPrefix = this.initialAjaxWithPrefix;
|
||||
meta_tag.remove();
|
||||
meta_tag = null;
|
||||
});
|
||||
|
||||
it('if path_prefix is not defined', function() {
|
||||
meta_tag = $('<meta name="path_prefix1" content="">');
|
||||
meta_tag.appendTo('body');
|
||||
spyOn(jQuery, 'ajax');
|
||||
Logger.log('example', 'data');
|
||||
expect(jQuery.ajax).toHaveBeenCalledWith({
|
||||
url: 'undefined/event',
|
||||
type: 'POST',
|
||||
data: {
|
||||
event_type: 'example',
|
||||
event: '"data"',
|
||||
page: window.location.href
|
||||
},
|
||||
async: true
|
||||
});
|
||||
});
|
||||
|
||||
it('if path_prefix is defined', function() {
|
||||
meta_tag = $('<meta name="path_prefix" content="">');
|
||||
meta_tag.appendTo('body');
|
||||
spyOn(jQuery, 'ajax');
|
||||
Logger.log('example', 'data');
|
||||
expect(jQuery.ajax).toHaveBeenCalledWith({
|
||||
url: '/event',
|
||||
type: 'POST',
|
||||
data: {
|
||||
event_type: 'example',
|
||||
event: '"data"',
|
||||
page: window.location.href
|
||||
},
|
||||
async: true
|
||||
});
|
||||
});
|
||||
|
||||
it('if path_prefix is custom value', function() {
|
||||
meta_tag = $('<meta name="path_prefix" content="testpath">');
|
||||
meta_tag.appendTo('body');
|
||||
spyOn(jQuery, 'ajax');
|
||||
Logger.log('example', 'data');
|
||||
expect(jQuery.ajax).toHaveBeenCalledWith({
|
||||
url: 'testpath/event',
|
||||
type: 'POST',
|
||||
data: {
|
||||
event_type: 'example',
|
||||
event: '"data"',
|
||||
page: window.location.href
|
||||
},
|
||||
async: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('listen', function() {
|
||||
beforeEach(function () {
|
||||
spyOn(jQuery, 'ajaxWithPrefix');
|
||||
|
||||
@@ -23,6 +23,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="google" content="notranslate">
|
||||
<meta name="path_prefix" content="${EDX_ROOT_URL}">
|
||||
<title>${current_chapter['title'] if current_chapter else '' |h}</title>
|
||||
|
||||
<link rel="stylesheet" href="${static.url('/static/css/vendor/pdfjs/viewer.css')}"/>
|
||||
|
||||
Reference in New Issue
Block a user