Merge pull request #2443 from Human-Connection/2237-longer-comments

Fix #2237, Comments 4 times as long before "show more"
This commit is contained in:
mattwr18 2019-12-10 11:07:24 +01:00 committed by GitHub
commit 65cf8e4792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 1 deletions

View File

@ -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");
});

View File

@ -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

View File

@ -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