Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2237, Comments 4 times as long before "show more" #2443

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cypress/integration/common/post.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,14 @@ import { When, Then } from "cypress-cucumber-preprocessor/steps";
const narratorAvatar =
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";

When("I type in a comment with {int} characters", size => {
var c="";
for (var i = 0; i < size; i++) {
c += "c"
}
cy.get(".editor .ProseMirror").type(c);
});

Then("I click on the {string} button", text => {
cy.get("button")
.contains(text)
@@ -23,6 +31,16 @@ Then("I should see my comment", () => {
.should("contain", "today at");
});

Then("I should see the entirety of my comment", () => {
cy.get("div.comment")
.should("not.contain", "show more")
});

Then("I should see an abreviated version of my comment", () => {
cy.get("div.comment")
.should("contain", "show more")
});

Then("the editor should be cleared", () => {
cy.get(".ProseMirror p").should("have.class", "is-empty");
});
16 changes: 16 additions & 0 deletions cypress/integration/post/Comment.feature
Original file line number Diff line number Diff line change
@@ -20,3 +20,19 @@ Feature: Post Comment
Then my comment should be successfully created
And I should see my comment
And the editor should be cleared

Scenario: View medium length comments
Given I visit "post/bWBjpkTKZp/101-essays"
And I type in a comment with 305 characters
And I click on the "Comment" button
Then my comment should be successfully created
And I should see the entirety of my comment
And the editor should be cleared

Scenario: View long comments
Given I visit "post/bWBjpkTKZp/101-essays"
And I type in a comment with 1205 characters
And I click on the "Comment" button
Then my comment should be successfully created
And I should see an abreviated version of my comment
And the editor should be cleared
2 changes: 1 addition & 1 deletion webapp/constants/comment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const COMMENT_MIN_LENGTH = 1
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 300
export const COMMENT_MAX_UNTRUNCATED_LENGTH = 1200
export const COMMENT_TRUNCATE_TO_LENGTH = 180