Fix bug where new posts were not assigned a topic ID and would fail to post

TNL-5442
This commit is contained in:
Brian Jacobel
2016-09-07 15:00:01 -04:00
parent 49f99146ec
commit 545ef583e7
4 changed files with 13 additions and 4 deletions

View File

@@ -46,7 +46,7 @@
'[data-discussion-id="' + this.getCurrentTopicId() + '"]')
);
} else {
this.setTopic(this.$('.topic-title').first());
this.setTopic(this.$('button.topic-title').first());
}
return this.$el;
},

View File

@@ -177,7 +177,7 @@
DiscussionUtil.clearFormErrors(this.$('.post-errors'));
this.$('.wmd-preview p').html('');
if (this.isTabMode()) {
return this.topicView.setTopic(this.$('.topic-title').first());
return this.topicView.setTopic(this.$('button.topic-title').first());
}
};

View File

@@ -135,7 +135,7 @@
var dropdownText;
this.createTopicView();
this.view.maxNameWidth = this.selectedOptionText.length + 100;
this.view.$el.find('.topic-title').first().click();
this.view.$el.find('button.topic-title').first().click();
dropdownText = this.view.$el.find('.js-selected-topic').text();
expect(dropdownText.indexOf('/ span>')).toEqual(-1);
});
@@ -152,6 +152,15 @@
expect(completeText).toEqual(dropdownText);
});
it("defaults to the first topic if you don't click one", function() {
this.createTopicView();
expect(
this.view.$el.find('.js-selected-topic').text()
).toMatch(
this.view.$el.find('.topic-menu-entry')[0].innerHTML
);
});
it('click outside of the dropdown close it', function() {
this.createTopicView();
this.openMenu();

View File

@@ -257,7 +257,7 @@
font-size: $forum-base-font-size;
}
a.topic-title {
button.topic-title {
@include transition(none);
&:hover, &:focus {