Commit 545ef583 by Brian Jacobel

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

TNL-5442
parent 49f99146
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
'[data-discussion-id="' + this.getCurrentTopicId() + '"]') '[data-discussion-id="' + this.getCurrentTopicId() + '"]')
); );
} else { } else {
this.setTopic(this.$('.topic-title').first()); this.setTopic(this.$('button.topic-title').first());
} }
return this.$el; return this.$el;
}, },
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
DiscussionUtil.clearFormErrors(this.$('.post-errors')); DiscussionUtil.clearFormErrors(this.$('.post-errors'));
this.$('.wmd-preview p').html(''); this.$('.wmd-preview p').html('');
if (this.isTabMode()) { if (this.isTabMode()) {
return this.topicView.setTopic(this.$('.topic-title').first()); return this.topicView.setTopic(this.$('button.topic-title').first());
} }
}; };
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
var dropdownText; var dropdownText;
this.createTopicView(); this.createTopicView();
this.view.maxNameWidth = this.selectedOptionText.length + 100; 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(); dropdownText = this.view.$el.find('.js-selected-topic').text();
expect(dropdownText.indexOf('/ span>')).toEqual(-1); expect(dropdownText.indexOf('/ span>')).toEqual(-1);
}); });
...@@ -152,6 +152,15 @@ ...@@ -152,6 +152,15 @@
expect(completeText).toEqual(dropdownText); 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() { it('click outside of the dropdown close it', function() {
this.createTopicView(); this.createTopicView();
this.openMenu(); this.openMenu();
......
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
font-size: $forum-base-font-size; font-size: $forum-base-font-size;
} }
a.topic-title { button.topic-title {
@include transition(none); @include transition(none);
&:hover, &:focus { &:hover, &:focus {
......
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