Commit c2e5b606 by E. Kolpakov Committed by Zia Fazal

Fixed errors in discussion XModule, caused by c2716d47 [TNL-606]

Co-Authored-By: jmclaus <jmc@edx.org>
Co-Authored-By: jsa <jsa@edx.org>
parent 422426ff
...@@ -116,10 +116,7 @@ ...@@ -116,10 +116,7 @@
testUpdate = function(view, thread) { testUpdate = function(view, thread) {
spyOn($, 'ajax').andCallFake(function(params) { spyOn($, 'ajax').andCallFake(function(params) {
expect(params.url.path()).toEqual(DiscussionUtil.urlFor('update_thread', 'dummy_id')); expect(params.url.path()).toEqual(DiscussionUtil.urlFor('update_thread', 'dummy_id'));
if (view.isTabMode()) {
// TODO remove the tabMode condition, depends on #5554 / TNL-606
expect(params.data.thread_type).toBe('discussion'); expect(params.data.thread_type).toBe('discussion');
}
expect(params.data.commentable_id).toBe('other_topic'); expect(params.data.commentable_id).toBe('other_topic');
expect(params.data.title).toBe('changed thread title'); expect(params.data.title).toBe('changed thread title');
params.success(); params.success();
...@@ -132,15 +129,12 @@ ...@@ -132,15 +129,12 @@
expect($.ajax).toHaveBeenCalled(); expect($.ajax).toHaveBeenCalled();
expect(thread.get('title')).toBe('changed thread title'); expect(thread.get('title')).toBe('changed thread title');
if (view.isTabMode()) {
// TODO remove the tabMode condition, depends on #5554 / TNL-606
expect(thread.get('thread_type')).toBe('discussion'); expect(thread.get('thread_type')).toBe('discussion');
}
expect(thread.get('commentable_id')).toBe('other_topic'); expect(thread.get('commentable_id')).toBe('other_topic');
expect(thread.get('courseware_title')).toBe('Other Topic'); expect(thread.get('courseware_title')).toBe('Other Topic');
expect(view.$('.edit-post-title')).toHaveValue(''); expect(view.$('.edit-post-title')).toHaveValue('');
expect(view.$('.wmd-preview p')).toHaveText(''); expect(view.$('.wmd-preview p')).toHaveText('');
} };
it('can save new data correctly in tab mode', function() { it('can save new data correctly in tab mode', function() {
this.createEditView(); this.createEditView();
......
...@@ -321,7 +321,6 @@ describe "NewPostView", -> ...@@ -321,7 +321,6 @@ describe "NewPostView", ->
view.$(".cancel").click() view.$(".cancel").click()
expect(eventSpy).toHaveBeenCalled() expect(eventSpy).toHaveBeenCalled()
expect(view.$(".post-errors").html()).toEqual(""); expect(view.$(".post-errors").html()).toEqual("");
if mode == "tab"
expect($("input[id$='post-type-question']")).toBeChecked() expect($("input[id$='post-type-question']")).toBeChecked()
expect($("input[id$='post-type-discussion']")).not.toBeChecked() expect($("input[id$='post-type-discussion']")).not.toBeChecked()
expect(view.$(".js-post-title").val()).toEqual(""); expect(view.$(".js-post-title").val()).toEqual("");
......
...@@ -23,8 +23,6 @@ if Backbone? ...@@ -23,8 +23,6 @@ if Backbone?
$('.group-selector-wrapper').hide() $('.group-selector-wrapper').hide()
@addField(threadTypeTemplate({form_id: _.uniqueId("form-")})); @addField(threadTypeTemplate({form_id: _.uniqueId("form-")}));
if @isTabMode() if @isTabMode()
threadTypeTemplate = _.template($("#thread-type-template").html());
@addField(threadTypeTemplate({form_id: _.uniqueId("form-")}));
@topicView = new DiscussionTopicMenuView { @topicView = new DiscussionTopicMenuView {
topicId: @topicId topicId: @topicId
course_settings: @course_settings, course_settings: @course_settings,
......
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