diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index 2c35cb280..3f5e0f3b2 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -5,7 +5,7 @@ import orderBy from 'lodash/orderBy' const languages = orderBy(locales, 'name') const narratorAvatar = "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg"; - +let expectedValue = { title: 'new post', content: 'new post content', src: 'onourjourney' } When("I type in a comment with {int} characters", size => { var c=""; for (var i = 0; i < size; i++) { @@ -119,13 +119,15 @@ Then("I add all required fields", () => { }) Then("the post was saved successfully with the {string} teaser image", condition => { + if (condition === 'change') + expectedValue = { title: 'to be updated', content: 'successfully updated', src: 'humanconnection' } cy.get(".ds-card-content > .ds-heading") - .should("contain", condition === 'new' ? 'new post' : 'to be updated') + .should("contain", expectedValue.title) .get(".content") - .should("contain", condition === 'new' ? 'new post content' : 'successfully updated') + .should("contain", expectedValue.content) .get('.post-page img') .should("have.attr", "src") - .and("contains", condition === 'new' ? "onourjourney" : "humanconnection") + .and("contains", expectedValue.src) }) Then("the first image should be removed from the preview", () => { diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index 82ab65318..534331347 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -114,13 +114,13 @@ export default { }, cropImage() { this.showCropper = false - if (this.file.type === 'image/png' || this.file.type === 'image/svg+xml') { - this.uploadSvgOrPng() - } else { + if (this.file.type === 'image/jpeg') { this.uploadJpeg() + } else { + this.uploadOtherImageType() } }, - uploadSvgOrPng() { + uploadOtherImageType() { this.imageAspectRatio = this.file.width / this.file.height || 1.0 this.image = new Image() this.image.src = this.file.dataURL