Merge remote-tracking branch 'origin/release' into jeskew/resolve_issues_with_release
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
Tests for the fix_not_found management command
|
||||
"""
|
||||
|
||||
from django.core.management import call_command
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
|
||||
class TestFixNotFound(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the fix_not_found management command
|
||||
"""
|
||||
def test_fix_not_found_non_split(self):
|
||||
"""
|
||||
The management command doesn't work on non split courses
|
||||
"""
|
||||
course = CourseFactory(default_store=ModuleStoreEnum.Type.mongo)
|
||||
with self.assertRaises(SystemExit):
|
||||
call_command("fix_not_found", unicode(course.id))
|
||||
|
||||
def test_fix_not_found(self):
|
||||
course = CourseFactory.create(default_store=ModuleStoreEnum.Type.split)
|
||||
ItemFactory.create(category='chapter', parent_location=course.location)
|
||||
|
||||
# get course again in order to update its children list
|
||||
course = self.store.get_course(course.id)
|
||||
|
||||
# create a dangling usage key that we'll add to the course's children list
|
||||
dangling_pointer = course.id.make_usage_key('chapter', 'DanglingPointer')
|
||||
|
||||
course.children.append(dangling_pointer)
|
||||
self.store.update_item(course, self.user.id)
|
||||
|
||||
# the course block should now point to two children, one of which
|
||||
# doesn't actually exist
|
||||
self.assertEqual(len(course.children), 2)
|
||||
self.assertIn(dangling_pointer, course.children)
|
||||
|
||||
call_command("fix_not_found", unicode(course.id))
|
||||
|
||||
# make sure the dangling pointer was removed from
|
||||
# the course block's children
|
||||
course = self.store.get_course(course.id)
|
||||
self.assertEqual(len(course.children), 1)
|
||||
self.assertNotIn(dangling_pointer, course.children)
|
||||
@@ -46,8 +46,8 @@ function(_, str, Backbone, BackboneRelational, gettext) {
|
||||
'title': gettext('Signatory title should span over maximum of 2 lines.')
|
||||
}, errors);
|
||||
}
|
||||
else if ((lines.length > 1 && (lines[0].length > 40 || lines[1].length > 40)) ||
|
||||
(lines.length === 1 && title.length > 40)) {
|
||||
else if ((lines.length > 1 && (lines[0].length > 53 && lines[1].length > 53)) ||
|
||||
(lines.length === 1 && title.length > 106)) {
|
||||
errors = _.extend({
|
||||
'title': gettext('Signatory title should have maximum of 40 characters per line.')
|
||||
}, errors);
|
||||
|
||||
@@ -246,7 +246,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
inputSignatoryTitle: 'New Signatory Test Title longer than 40 characters in length'
|
||||
inputSignatoryTitle: 'This is a certificate signatory title that has waaaaaaay more than 106 characters, in order to cause an exception.'
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
|
||||
@@ -228,7 +228,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
|
||||
}
|
||||
);
|
||||
|
||||
it('signatories should not save when title has more than 40 characters per line', function() {
|
||||
it('signatories should not save when fields have too many characters per line', function() {
|
||||
this.view.$(SELECTORS.addSignatoryButton).click();
|
||||
setValuesToInputs(this.view, {
|
||||
inputCertificateName: 'New Certificate Name'
|
||||
@@ -239,7 +239,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
inputSignatoryTitle: 'New Signatory title longer than 40 characters on one line'
|
||||
inputSignatoryTitle: 'This is a certificate signatory title that has waaaaaaay more than 106 characters, in order to cause an exception.'
|
||||
});
|
||||
|
||||
setValuesToInputs(this.view, {
|
||||
|
||||
@@ -574,6 +574,25 @@ define(["jquery", "underscore", "underscore.string", "common/js/spec_helpers/aja
|
||||
});
|
||||
});
|
||||
|
||||
it('also works for older-style add component links', function () {
|
||||
// Some third party xblocks (problem-builder in particular) expect add
|
||||
// event handlers on custom <a> add buttons which is what the platform
|
||||
// used to use instead of <button>s.
|
||||
// This can be removed once there is a proper API that XBlocks can use
|
||||
// to add children or allow authors to add children.
|
||||
renderContainerPage(this, mockContainerXBlockHtml);
|
||||
$(".add-xblock-component-button").each(function() {
|
||||
var htmlAsLink = $($(this).prop('outerHTML').replace(/(<\/?)button/g, "$1a"));
|
||||
$(this).replaceWith(htmlAsLink);
|
||||
});
|
||||
$(".add-xblock-component-button").first().click();
|
||||
EditHelpers.verifyXBlockRequest(requests, {
|
||||
"category": "discussion",
|
||||
"type": "discussion",
|
||||
"parent_locator": "locator-group-A"
|
||||
});
|
||||
});
|
||||
|
||||
it('shows a notification while creating', function () {
|
||||
var notificationSpy = EditHelpers.createNotificationSpy();
|
||||
renderContainerPage(this, mockContainerXBlockHtml);
|
||||
|
||||
@@ -6,8 +6,8 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "common/js/compo
|
||||
function ($, _, gettext, BaseView, ViewUtils, AddXBlockButton, AddXBlockMenu) {
|
||||
var AddXBlockComponent = BaseView.extend({
|
||||
events: {
|
||||
'click .new-component .new-component-type button.multiple-templates': 'showComponentTemplates',
|
||||
'click .new-component .new-component-type button.single-template': 'createNewComponent',
|
||||
'click .new-component .new-component-type .multiple-templates': 'showComponentTemplates',
|
||||
'click .new-component .new-component-type .single-template': 'createNewComponent',
|
||||
'click .new-component .cancel-button': 'closeNewComponent',
|
||||
'click .new-component-templates .new-component-template .button-component': 'createNewComponent',
|
||||
'click .new-component-templates .cancel-button': 'closeNewComponent'
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
</div>
|
||||
<div class="input-wrap field text add-signatory-title <% if(error && error.title) { print('error'); } %>">
|
||||
<label for="signatory-title-<%= signatory_number %>"><%= gettext("Title ") %></label>
|
||||
<textarea id="signatory-title-<%= signatory_number %>" class="collection-name-input text input-text signatory-title-input" name="signatory-title" cols="40" rows="2" placeholder="<%= gettext("Title of the signatory") %>" aria-describedby="signatory-title-<%= signatory_number %>-tip" maxlength="80"><%= title %></textarea>
|
||||
<span id="signatory-title-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("The title of this signatory as it should appear on certificates. Maximum 2 lines, 40 characters each.") %></span>
|
||||
<textarea id="signatory-title-<%= signatory_number %>" class="collection-name-input text input-text signatory-title-input" name="signatory-title" cols="40" rows="2" placeholder="<%= gettext("Title of the signatory") %>" aria-describedby="signatory-title-<%= signatory_number %>-tip" maxlength="106"><%= title %></textarea>
|
||||
<span id="signatory-title-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("The title of this signatory as it should appear on certificates. Maximum of 106 characters.") %></span>
|
||||
<% if(error && error.title) { %>
|
||||
<span class="message-error"><%= error.title %></span>
|
||||
<% } %>
|
||||
@@ -44,7 +44,7 @@
|
||||
<span id="signatory-signature-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("Image must be 450px X 150px transparent PNG") %></span>
|
||||
</div>
|
||||
<button type="button" class="action action-upload-signature">Upload Signature Image</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user