@@ -37,24 +37,24 @@ context('Discussions', () => { | |||
}; | |||
const reply_through_comment_box = () => { | |||
cy.get('.discussion-on-page:visible .comment-field') | |||
cy.get('.discussion-form:visible .comment-field') | |||
.type('This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.') | |||
.should('have.value', 'This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.'); | |||
cy.get('.discussion-on-page:visible .submit-discussion').click(); | |||
cy.get('.discussion-form:visible .submit-discussion').click(); | |||
cy.wait(3000); | |||
cy.get('.discussion-on-page:visible').should('have.class', 'show'); | |||
cy.get('.discussion-on-page:visible').children(".reply-card").eq(1).children(".reply-text") | |||
cy.get('.discussion-on-page:visible').children(".reply-card").eq(1).find(".reply-text") | |||
.should('have.text', 'This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.\n'); | |||
}; | |||
const cancel_and_clear_comment_box = () => { | |||
cy.get('.discussion-on-page:visible .comment-field') | |||
cy.get('.discussion-form:visible .comment-field') | |||
.type('This is a discussion from the cypress ui tests.') | |||
.should('have.value', 'This is a discussion from the cypress ui tests.'); | |||
cy.get('.discussion-on-page:visible .cancel-comment').click(); | |||
cy.get('.discussion-on-page:visible .comment-field').should('have.value', ''); | |||
cy.get('.discussion-form:visible .cancel-comment').click(); | |||
cy.get('.discussion-form:visible .comment-field').should('have.value', ''); | |||
}; | |||
const single_thread_discussion = () => { | |||
@@ -62,13 +62,13 @@ context('Discussions', () => { | |||
cy.get('.discussions-sidebar').should('have.length', 0); | |||
cy.get('.reply').should('have.length', 0); | |||
cy.get('.discussion-on-page .comment-field') | |||
cy.get('.discussion-form:visible .comment-field') | |||
.type('This comment is being made on a single thread discussion.') | |||
.should('have.value', 'This comment is being made on a single thread discussion.'); | |||
cy.get('.discussion-on-page .submit-discussion').click(); | |||
cy.get('.discussion-form:visible .submit-discussion').click(); | |||
cy.wait(3000); | |||
cy.get('.discussion-on-page').children(".reply-card").eq(-1).children(".reply-text") | |||
cy.get('.discussion-on-page').children(".reply-card").eq(-1).find(".reply-text") | |||
.should('have.text', 'This comment is being made on a single thread discussion.\n'); | |||
}; | |||
@@ -132,7 +132,7 @@ const update_message = (data) => { | |||
reply_card.find(".reply-edit-card").addClass("hide"); | |||
reply_card.find(".reply-text").html(data.reply); | |||
reply_card.find(".reply-actions").addClass("hide"); | |||
} | |||
}; | |||
const post_message_cleanup = () => { | |||
$(".topic-title").val(""); | |||
@@ -5,13 +5,13 @@ | |||
{% endif %} | |||
<div class="collapse discussion-on-page common-card-style" data-parent="#discussion-group" | |||
<div class=" {% if not single_thread %} collapse {% endif %} discussion-on-page common-card-style" data-parent="#discussion-group" | |||
{% if topic %} id="t{{ topic.name }}" data-topic="{{ topic.name }}" {% endif %}> | |||
<div class="reply-section-header"> | |||
{% if not single_thread %} | |||
<div class="back-button"> | |||
<svg class="icon icon-md"> | |||
<svg class="icon icon-md"> | |||
<use class="" href="#icon-left"></use> | |||
</svg> | |||
</div> | |||
@@ -139,7 +139,7 @@ | |||
.discussion-heading { | |||
font-weight: 600; | |||
font-size: 22px; | |||
font-size: var(--text-3xl); | |||
line-height: 146%; | |||
letter-spacing: -0.0175em; | |||
color: var(--gray-900); | |||
@@ -187,8 +187,10 @@ | |||
} | |||
.reply-author { | |||
display: flex; | |||
align-items: center; | |||
margin: 0px 8px; | |||
font-size: 12px; | |||
font-size: var(--text-sm); | |||
line-height: 135%; | |||
color: var(--gray-900); | |||
} | |||
@@ -252,11 +254,6 @@ | |||
margin-bottom: 2.5rem; | |||
} | |||
.reply-author { | |||
display: flex; | |||
align-items: center; | |||
} | |||
.reply-header { | |||
display: flex; | |||
align-items: center; | |||
@@ -199,39 +199,40 @@ def create_data_for_discussions(): | |||
def create_web_page(title, route, single_thread): | |||
web_page = frappe.db.exists("Web Page", {"route": route}) | |||
if not web_page: | |||
web_page = frappe.get_doc({ | |||
if web_page: | |||
return web_page | |||
web_page = frappe.get_doc({ | |||
"doctype": "Web Page", | |||
"title": title, | |||
"route": route, | |||
"published": True | |||
}) | |||
web_page.save() | |||
web_page.append("page_blocks", { | |||
"web_template": "Discussions", | |||
"web_template_values": frappe.as_json({ | |||
"title": "Discussions", | |||
"cta_title": "New Discussion", | |||
"docname": web_page.name, | |||
"single_thread": single_thread | |||
}) | |||
web_page.save() | |||
web_page.append("page_blocks", { | |||
"web_template": "Discussions", | |||
"web_template_values": frappe.as_json({ | |||
"title": "Discussions", | |||
"cta_title": "New Discussion", | |||
"docname": web_page.name, | |||
"single_thread": single_thread | |||
}) | |||
web_page.save() | |||
}) | |||
web_page.save() | |||
return web_page | |||
return web_page.name | |||
def create_topic_and_reply(web_page): | |||
topic = frappe.db.exists("Discussion Topic",{ | |||
"reference_doctype": "Web Page", | |||
"reference_docname": web_page.name | |||
"reference_docname": web_page | |||
}) | |||
if not topic: | |||
topic = frappe.get_doc({ | |||
"doctype": "Discussion Topic", | |||
"reference_doctype": "Web Page", | |||
"reference_docname": web_page.name, | |||
"reference_docname": web_page, | |||
"title": "Test Topic" | |||
}) | |||
topic.save() | |||
@@ -268,4 +269,4 @@ def update_child_table(name): | |||
'options': 'Doctype to Link' | |||
}) | |||
doc.save() | |||
doc.save() |