Commit bb534a8c by Waqas Khalid Committed by Zia Fazal

In inline discussion two discussion module override actions

In inline discussion if we have two discussion module the
new post button open form for both discussions as well as
cancel button of one discussion call the cancel of other.
Click and button actions are now being handled inside view
of each module so that they don't disturb eachother.

TNL-776
parent 50fcfa8a
...@@ -98,7 +98,7 @@ if Backbone? ...@@ -98,7 +98,7 @@ if Backbone?
else else
@$el.append($discussion) @$el.append($discussion)
@newPostForm = $('.new-post-article') @newPostForm = this.$el.find('.new-post-article')
@threadviews = @discussion.map (thread) => @threadviews = @discussion.map (thread) =>
view = new DiscussionThreadView( view = new DiscussionThreadView(
el: @$("article#thread_#{thread.id}"), el: @$("article#thread_#{thread.id}"),
......
...@@ -323,6 +323,35 @@ class InlineDiscussionPage(PageObject): ...@@ -323,6 +323,35 @@ class InlineDiscussionPage(PageObject):
def element_exists(self, selector): def element_exists(self, selector):
return self.q(css=self._discussion_selector + " " + selector).present return self.q(css=self._discussion_selector + " " + selector).present
def is_new_post_opened(self):
return self._find_within(".new-post-article").visible
def click_element(self, selector):
self.wait_for_element_presence(
"{discussion} {selector}".format(discussion=self._discussion_selector, selector=selector),
"{selector} is visible".format(selector=selector)
)
self._find_within(selector).click()
def click_cancel_new_post(self):
self.click_element(".cancel")
EmptyPromise(
lambda: not self.is_new_post_opened(),
"New post closed"
).fulfill()
def click_new_post_button(self):
self.click_element(".new-post-btn")
EmptyPromise(
self.is_new_post_opened,
"New post opened"
).fulfill()
@wait_for_js
def _is_element_visible(self, selector):
query = self._find_within(selector)
return query.present and query.visible
class InlineDiscussionThreadPage(DiscussionThreadPage): class InlineDiscussionThreadPage(DiscussionThreadPage):
def __init__(self, browser, thread_id): def __init__(self, browser, thread_id):
......
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