Run eslint autofixer on /cms
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
var getModulesList = function(modules) {
|
||||
var result = [getModule(commonLibrariesPath)];
|
||||
return result.concat(modules.map(function (moduleName) {
|
||||
return result.concat(modules.map(function(moduleName) {
|
||||
return getModule(moduleName, true);
|
||||
}));
|
||||
};
|
||||
@@ -171,4 +171,5 @@
|
||||
*/
|
||||
logLevel: 1
|
||||
};
|
||||
}())
|
||||
}()) // eslint-disable-line semi
|
||||
// A semicolon on the line above will break the requirejs optimizer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;(function(require, define) {
|
||||
(function(require, define) {
|
||||
'use strict';
|
||||
|
||||
if (window) {
|
||||
@@ -210,12 +210,12 @@
|
||||
window.MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
inlineMath: [
|
||||
['\\(','\\)'],
|
||||
['[mathjaxinline]','[/mathjaxinline]']
|
||||
['\\(', '\\)'],
|
||||
['[mathjaxinline]', '[/mathjaxinline]']
|
||||
],
|
||||
displayMath: [
|
||||
['\\[','\\]'],
|
||||
['[mathjax]','[/mathjax]']
|
||||
['\\[', '\\]'],
|
||||
['[mathjax]', '[/mathjax]']
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,81 +2,81 @@
|
||||
|
||||
(function(sandbox) {
|
||||
'use strict';
|
||||
require(["jquery", "backbone", "cms/js/main", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "jquery.cookie"],
|
||||
require(['jquery', 'backbone', 'cms/js/main', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'jquery.cookie'],
|
||||
function($, Backbone, main, AjaxHelpers) {
|
||||
describe("CMS", function() {
|
||||
it("should initialize URL", function() {
|
||||
expect(window.CMS.URL).toBeDefined();
|
||||
});
|
||||
});
|
||||
describe("main helper", function() {
|
||||
beforeEach(function() {
|
||||
this.previousAjaxSettings = $.extend(true, {}, $.ajaxSettings);
|
||||
spyOn($, "cookie").and.callFake(function(param) {
|
||||
if (param === "csrftoken") {
|
||||
return "stubCSRFToken";
|
||||
}
|
||||
describe('CMS', function() {
|
||||
it('should initialize URL', function() {
|
||||
expect(window.CMS.URL).toBeDefined();
|
||||
});
|
||||
});
|
||||
return main();
|
||||
});
|
||||
afterEach(function() {
|
||||
$.ajaxSettings = this.previousAjaxSettings;
|
||||
return $.ajaxSettings;
|
||||
});
|
||||
it("turn on Backbone emulateHTTP", function() {
|
||||
expect(Backbone.emulateHTTP).toBeTruthy();
|
||||
});
|
||||
it("setup AJAX CSRF token", function() {
|
||||
expect($.ajaxSettings.headers["X-CSRFToken"]).toEqual("stubCSRFToken");
|
||||
});
|
||||
});
|
||||
describe("AJAX Errors", function() {
|
||||
var server;
|
||||
server = null;
|
||||
beforeEach(function() {
|
||||
appendSetFixtures(sandbox({
|
||||
id: "page-notification"
|
||||
}));
|
||||
});
|
||||
afterEach(function() {
|
||||
return server && server.restore();
|
||||
});
|
||||
it("successful AJAX request does not pop an error notification", function() {
|
||||
server = AjaxHelpers.server([
|
||||
200, {
|
||||
"Content-Type": "application/json"
|
||||
}, "{}"
|
||||
]);
|
||||
expect($("#page-notification")).toBeEmpty();
|
||||
$.ajax("/test");
|
||||
expect($("#page-notification")).toBeEmpty();
|
||||
server.respond();
|
||||
expect($("#page-notification")).toBeEmpty();
|
||||
});
|
||||
it("AJAX request with error should pop an error notification", function() {
|
||||
server = AjaxHelpers.server([
|
||||
500, {
|
||||
"Content-Type": "application/json"
|
||||
}, "{}"
|
||||
]);
|
||||
$.ajax("/test");
|
||||
server.respond();
|
||||
expect($("#page-notification")).not.toBeEmpty();
|
||||
expect($("#page-notification")).toContainElement('div.wrapper-notification-error');
|
||||
});
|
||||
it("can override AJAX request with error so it does not pop an error notification", function() {
|
||||
server = AjaxHelpers.server([
|
||||
500, {
|
||||
"Content-Type": "application/json"
|
||||
}, "{}"
|
||||
]);
|
||||
$.ajax({
|
||||
url: "/test",
|
||||
notifyOnError: false
|
||||
describe('main helper', function() {
|
||||
beforeEach(function() {
|
||||
this.previousAjaxSettings = $.extend(true, {}, $.ajaxSettings);
|
||||
spyOn($, 'cookie').and.callFake(function(param) {
|
||||
if (param === 'csrftoken') {
|
||||
return 'stubCSRFToken';
|
||||
}
|
||||
});
|
||||
return main();
|
||||
});
|
||||
afterEach(function() {
|
||||
$.ajaxSettings = this.previousAjaxSettings;
|
||||
return $.ajaxSettings;
|
||||
});
|
||||
it('turn on Backbone emulateHTTP', function() {
|
||||
expect(Backbone.emulateHTTP).toBeTruthy();
|
||||
});
|
||||
it('setup AJAX CSRF token', function() {
|
||||
expect($.ajaxSettings.headers['X-CSRFToken']).toEqual('stubCSRFToken');
|
||||
});
|
||||
});
|
||||
describe('AJAX Errors', function() {
|
||||
var server;
|
||||
server = null;
|
||||
beforeEach(function() {
|
||||
appendSetFixtures(sandbox({
|
||||
id: 'page-notification'
|
||||
}));
|
||||
});
|
||||
afterEach(function() {
|
||||
return server && server.restore();
|
||||
});
|
||||
it('successful AJAX request does not pop an error notification', function() {
|
||||
server = AjaxHelpers.server([
|
||||
200, {
|
||||
'Content-Type': 'application/json'
|
||||
}, '{}'
|
||||
]);
|
||||
expect($('#page-notification')).toBeEmpty();
|
||||
$.ajax('/test');
|
||||
expect($('#page-notification')).toBeEmpty();
|
||||
server.respond();
|
||||
expect($('#page-notification')).toBeEmpty();
|
||||
});
|
||||
it('AJAX request with error should pop an error notification', function() {
|
||||
server = AjaxHelpers.server([
|
||||
500, {
|
||||
'Content-Type': 'application/json'
|
||||
}, '{}'
|
||||
]);
|
||||
$.ajax('/test');
|
||||
server.respond();
|
||||
expect($('#page-notification')).not.toBeEmpty();
|
||||
expect($('#page-notification')).toContainElement('div.wrapper-notification-error');
|
||||
});
|
||||
it('can override AJAX request with error so it does not pop an error notification', function() {
|
||||
server = AjaxHelpers.server([
|
||||
500, {
|
||||
'Content-Type': 'application/json'
|
||||
}, '{}'
|
||||
]);
|
||||
$.ajax({
|
||||
url: '/test',
|
||||
notifyOnError: false
|
||||
});
|
||||
server.respond();
|
||||
expect($('#page-notification')).toBeEmpty();
|
||||
});
|
||||
});
|
||||
server.respond();
|
||||
expect($("#page-notification")).toBeEmpty();
|
||||
});
|
||||
});
|
||||
});
|
||||
}).call(this, sandbox);
|
||||
|
||||
@@ -24,7 +24,6 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
|
||||
StudioRuntime = {};
|
||||
|
||||
BaseRuntime.v1 = (function(_super) {
|
||||
|
||||
__extends(v1, _super);
|
||||
|
||||
v1.prototype.handlerUrl = function(element, handlerName, suffix, query) {
|
||||
@@ -150,11 +149,9 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
|
||||
};
|
||||
|
||||
return v1;
|
||||
|
||||
})(XBlock.Runtime.v1);
|
||||
|
||||
PreviewRuntime.v1 = (function(_super) {
|
||||
|
||||
__extends(v1, _super);
|
||||
|
||||
function v1() {
|
||||
@@ -164,11 +161,9 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
|
||||
v1.prototype.handlerPrefix = '/preview/xblock';
|
||||
|
||||
return v1;
|
||||
|
||||
})(BaseRuntime.v1);
|
||||
|
||||
StudioRuntime.v1 = (function(_super) {
|
||||
|
||||
__extends(v1, _super);
|
||||
|
||||
function v1() {
|
||||
@@ -178,7 +173,6 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
|
||||
v1.prototype.handlerPrefix = '/xblock';
|
||||
|
||||
return v1;
|
||||
|
||||
})(BaseRuntime.v1);
|
||||
|
||||
// Install the runtime's into the global namespace
|
||||
|
||||
Reference in New Issue
Block a user