Merge pull request #13406 from edx/bjacobel/toolbarmageddon
Toolbarmageddon! (TNL-5105)
This commit is contained in:
@@ -309,7 +309,7 @@
|
||||
var appended_id, editor, elem, id, imageUploadUrl, placeholder, _processor;
|
||||
elem = $local('.' + cls_identifier);
|
||||
placeholder = elem.data('placeholder');
|
||||
id = elem.attr('data-id');
|
||||
id = elem.data('id');
|
||||
appended_id = '-' + cls_identifier + '-' + id;
|
||||
imageUploadUrl = this.urlFor('upload');
|
||||
_processor = function(self) {
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
container = $('.discussion-module');
|
||||
}
|
||||
templateData = _.extend(this.model.toJSON(), {
|
||||
wmdId: (_ref = this.model.id) !== null ? _ref : (new Date()).getTime(),
|
||||
wmdId: typeof(this.model.id) !== 'undefined' ? this.model.id : (new Date()).getTime(),
|
||||
create_sub_comment: container.data('user-create-subcomment'),
|
||||
readOnly: this.readOnly
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* globals DiscussionSpecHelper, ResponseCommentView, Thread, ThreadResponseView, ThreadResponseShowView */
|
||||
/* globals DiscussionSpecHelper, ResponseCommentView, Thread, ThreadResponseView, ThreadResponseShowView, _ */
|
||||
(function() {
|
||||
'use strict';
|
||||
describe('ThreadResponseView', function() {
|
||||
@@ -89,6 +89,25 @@
|
||||
return expect(this.view.$('.action-show-comments')).not.toBeVisible();
|
||||
}
|
||||
);
|
||||
it('calls renderTemplate with a temporary id if the model lacks one', function() {
|
||||
this.view = new ThreadResponseView({
|
||||
model: this.response,
|
||||
el: $('#fixture-element'),
|
||||
collapseComments: true
|
||||
});
|
||||
spyOn(_, 'extend').and.callThrough();
|
||||
spyOn(window, 'Date').and.callFake(function() {
|
||||
return {
|
||||
getTime: function() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
});
|
||||
this.view.render();
|
||||
expect(_.extend).toHaveBeenCalledWith(jasmine.any(Object), jasmine.objectContaining({
|
||||
wmdId: 1
|
||||
}));
|
||||
});
|
||||
it('populates commentViews and binds events', function() {
|
||||
this.view.createEditView();
|
||||
spyOn(this.view, 'cancelEdit');
|
||||
|
||||
Reference in New Issue
Block a user