Commit 44e70dc2 by Brian Jacobel Committed by GitHub

Merge pull request #13406 from edx/bjacobel/toolbarmageddon

Toolbarmageddon! (TNL-5105)
parents 12b8f9d9 2dcb8f81
...@@ -309,7 +309,7 @@ ...@@ -309,7 +309,7 @@
var appended_id, editor, elem, id, imageUploadUrl, placeholder, _processor; var appended_id, editor, elem, id, imageUploadUrl, placeholder, _processor;
elem = $local('.' + cls_identifier); elem = $local('.' + cls_identifier);
placeholder = elem.data('placeholder'); placeholder = elem.data('placeholder');
id = elem.attr('data-id'); id = elem.data('id');
appended_id = '-' + cls_identifier + '-' + id; appended_id = '-' + cls_identifier + '-' + id;
imageUploadUrl = this.urlFor('upload'); imageUploadUrl = this.urlFor('upload');
_processor = function(self) { _processor = function(self) {
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
container = $('.discussion-module'); container = $('.discussion-module');
} }
templateData = _.extend(this.model.toJSON(), { 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'), create_sub_comment: container.data('user-create-subcomment'),
readOnly: this.readOnly readOnly: this.readOnly
}); });
......
/* globals DiscussionSpecHelper, ResponseCommentView, Thread, ThreadResponseView, ThreadResponseShowView */ /* globals DiscussionSpecHelper, ResponseCommentView, Thread, ThreadResponseView, ThreadResponseShowView, _ */
(function() { (function() {
'use strict'; 'use strict';
describe('ThreadResponseView', function() { describe('ThreadResponseView', function() {
...@@ -89,6 +89,25 @@ ...@@ -89,6 +89,25 @@
return expect(this.view.$('.action-show-comments')).not.toBeVisible(); 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() { it('populates commentViews and binds events', function() {
this.view.createEditView(); this.view.createEditView();
spyOn(this.view, 'cancelEdit'); spyOn(this.view, 'cancelEdit');
......
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