Commit c32b30ba by Felipe Montoya

Relocating inside the cms namespace

Addressing feedback
parent 27d4e4bd
......@@ -34,9 +34,7 @@
message = str.truncate(jqXHR.responseText, 300);
}
} else {
message = gettext('This may be happening because of an error with our server' +
'or your internet connection. Try refreshing the page or making' +
'sure you are online.');
message = gettext('This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.'); //jshint ignore:line
}
msg = new NotificationView.Error({
'title': gettext("Studio's having trouble saving your work"),
......
......@@ -247,7 +247,7 @@
exports: 'XBlock',
deps: ['xblock/core']
},
'js/main': {
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
},
'js/src/logger': {
......
......@@ -199,7 +199,7 @@
'mock-ajax': {
deps: ['jquery']
},
'js/main': {
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
},
'coffee/src/ajax_prefix': {
......@@ -217,6 +217,7 @@
jasmine.getFixtures().fixturesPath += 'coffee/fixtures';
testFiles = [
'cms/js/spec/main_spec',
'cms/js/spec/xblock/cms.runtime.v1_spec',
'coffee/spec/models/course_spec',
'coffee/spec/models/metadata_spec',
......@@ -229,7 +230,6 @@
'coffee/spec/views/metadata_edit_spec',
'coffee/spec/views/textbook_spec',
'coffee/spec/views/upload_spec',
'js/spec/main_spec',
'js/spec/video/transcripts/utils_spec',
'js/spec/video/transcripts/editor_spec',
'js/spec/video/transcripts/videolist_spec',
......
(function(sandbox) {
'use strict';
require(["jquery", "backbone", "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() {
return it("should initialize URL", function() {
return expect(window.CMS.URL).toBeDefined();
it("should initialize URL", function() {
expect(window.CMS.URL).toBeDefined();
});
});
describe("main helper", function() {
......@@ -22,17 +22,17 @@
return $.ajaxSettings;
});
it("turn on Backbone emulateHTTP", function() {
return expect(Backbone.emulateHTTP).toBeTruthy();
expect(Backbone.emulateHTTP).toBeTruthy();
});
return it("setup AJAX CSRF token", function() {
return expect($.ajaxSettings.headers["X-CSRFToken"]).toEqual("stubCSRFToken");
it("setup AJAX CSRF token", function() {
expect($.ajaxSettings.headers["X-CSRFToken"]).toEqual("stubCSRFToken");
});
});
describe("AJAX Errors", function() {
var server;
server = null;
beforeEach(function() {
return appendSetFixtures(sandbox({
appendSetFixtures(sandbox({
id: "page-notification"
}));
});
......@@ -49,7 +49,7 @@
$.ajax("/test");
expect($("#page-notification")).toBeEmpty();
server.respond();
return expect($("#page-notification")).toBeEmpty();
expect($("#page-notification")).toBeEmpty();
});
it("AJAX request with error should pop an error notification", function() {
server = AjaxHelpers.server([
......@@ -60,7 +60,7 @@
$.ajax("/test");
server.respond();
expect($("#page-notification")).not.toBeEmpty();
return expect($("#page-notification")).toContainElement('div.wrapper-notification-error');
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([
......@@ -73,7 +73,7 @@
notifyOnError: false
});
server.respond();
return expect($("#page-notification")).toBeEmpty();
expect($("#page-notification")).toBeEmpty();
});
});
});
......
......@@ -174,7 +174,7 @@
exports: 'XBlock',
deps: ['xblock/core']
},
'js/main': {
'cms/js/main': {
deps: ['coffee/src/ajax_prefix']
},
'coffee/src/ajax_prefix': {
......
define ["backbone", "js/models/textbook", "js/collections/textbook", "js/models/chapter", "js/collections/chapter", "js/main"],
define ["backbone", "js/models/textbook", "js/collections/textbook", "js/models/chapter", "js/collections/chapter", "cms/js/main"],
(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) ->
describe "Textbook model", ->
......
define ["js/models/metadata", "js/collections/metadata", "js/views/metadata", "js/main"],
define ["js/models/metadata", "js/collections/metadata", "js/views/metadata", "cms/js/main"],
(MetadataModel, MetadataCollection, MetadataView, main) ->
verifyInputType = (input, expectedType) ->
# Some browsers (e.g. FireFox) do not support the "number"
......
......@@ -6,7 +6,7 @@ define([
'backbone-relational',
'backbone.associations',
'gettext',
'js/main',
'cms/js/main',
'js/certificates/models/signatory',
'js/certificates/collections/signatories'
],
......
define(['js/base', 'js/main', 'js/src/logger', 'datepair', 'accessibility',
define(['js/base', 'cms/js/main', 'js/src/logger', 'datepair', 'accessibility',
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
define([
'jquery', 'underscore', 'js/models/xblock_container_info', 'js/views/pages/container',
'js/collections/component_template', 'xmodule', 'js/main',
'js/collections/component_template', 'xmodule', 'cms/js/main',
'xblock/cms.runtime.v1'
],
function($, _, XBlockContainerInfo, ContainerPage, ComponentTemplates, xmoduleLoader) {
......
define([
'js/models/explicit_url', 'js/views/tabs', 'xmodule', 'js/main', 'xblock/cms.runtime.v1'
'js/models/explicit_url', 'js/views/tabs', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'
], function (TabsModel, TabsEditView, xmoduleLoader) {
'use strict';
return function (courseLocation, explicitUrl) {
......
define([
'jquery', 'underscore', 'js/models/xblock_info', 'js/views/pages/paged_container',
'js/views/library_container', 'js/collections/component_template', 'xmodule', 'js/main',
'js/views/library_container', 'js/collections/component_template', 'xmodule', 'cms/js/main',
'xblock/cms.runtime.v1'
],
function($, _, XBlockInfo, PagedContainerPage, LibraryContainerView, ComponentTemplates, xmoduleLoader) {
......
define([
'backbone', 'underscore', 'gettext', 'js/models/group', 'js/collections/group',
'backbone.associations', 'js/main'
'backbone.associations', 'cms/js/main'
],
function(Backbone, _, gettext, GroupModel, GroupCollection) {
'use strict';
......
define(["backbone", "underscore", "gettext", "js/models/chapter", "js/collections/chapter",
"backbone.associations", "js/main"],
"backbone.associations", "cms/js/main"],
function(Backbone, _, gettext, ChapterModel, ChapterCollection) {
var Textbook = Backbone.AssociatedModel.extend({
......
define([
'backbone', 'js/main', 'js/models/group_configuration',
'backbone', 'cms/js/main', 'js/models/group_configuration',
'js/models/group', 'js/collections/group', 'squire'
], function (Backbone, main, GroupConfigurationModel, GroupModel, GroupCollection, Squire) {
'use strict';
......
define([ "jquery", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "js/spec_helpers/edit_helpers",
"js/views/container", "js/models/xblock_info", "jquery.simulate",
"xmodule", "js/main", "xblock/cms.runtime.v1"],
"xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function ($, AjaxHelpers, EditHelpers, ContainerView, XBlockInfo) {
describe("Container View", function () {
......
define(["jquery", "URI", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "common/js/components/utils/view_utils",
"js/views/xblock", "js/models/xblock_info", "xmodule", "js/main", "xblock/cms.runtime.v1"],
"js/views/xblock", "js/models/xblock_info", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function ($, URI, AjaxHelpers, ViewUtils, XBlockView, XBlockInfo) {
"use strict";
describe("XBlockView", function() {
......
......@@ -3,7 +3,7 @@
*/
define(["jquery", "underscore", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers",
"common/js/spec_helpers/template_helpers", "js/spec_helpers/modal_helpers", "js/views/modals/edit_xblock",
"js/collections/component_template", "xmodule", "js/main", "xblock/cms.runtime.v1"],
"js/collections/component_template", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function($, _, AjaxHelpers, TemplateHelpers, modal_helpers, EditXBlockModal, ComponentTemplates) {
var installMockXBlock, uninstallMockXBlock, installMockXModule, uninstallMockXModule,
......
......@@ -22,6 +22,7 @@ var options = {
// Otherwise Istanbul which is used for coverage tracking will cause tests to not run.
sourceFiles: [
{pattern: 'coffee/src/**/!(*spec).js'},
{pattern: 'cms/js/**/!(*spec|djangojs).js'},
{pattern: 'js/**/!(*spec|djangojs).js'}
],
......
......@@ -39,7 +39,7 @@ REQUIREJS_WAIT = {
# Unit page
re.compile(r'^Unit \|'): [
"jquery", "js/base", "js/models/xblock_info", "js/views/pages/container",
"js/collections/component_template", "xmodule", "js/main", "xblock/cms.runtime.v1"],
"js/collections/component_template", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
# Content - Outline
# Note that calling your org, course number, or display name, 'course' will mess this up
......@@ -49,18 +49,18 @@ REQUIREJS_WAIT = {
# Dashboard
re.compile(r'^Studio Home \|'): [
"js/sock", "gettext", "js/base",
"jquery.ui", "js/main", "underscore"],
"jquery.ui", "cms/js/main", "underscore"],
# Upload
re.compile(r'^\s*Files & Uploads'): [
'js/base', 'jquery.ui', 'js/main', 'underscore',
'js/base', 'jquery.ui', 'cms/js/main', 'underscore',
'js/views/assets', 'js/views/asset'
],
# Pages
re.compile(r'^Pages \|'): [
'js/models/explicit_url', 'js/views/tabs',
'xmodule', 'js/main', 'xblock/cms.runtime.v1'
'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'
],
}
......
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