diff --git a/assets/js/src/newsletter_editor/blocks/products.js b/assets/js/src/newsletter_editor/blocks/products.js index f7c01a45f2..1c8af450fd 100644 --- a/assets/js/src/newsletter_editor/blocks/products.js +++ b/assets/js/src/newsletter_editor/blocks/products.js @@ -50,7 +50,7 @@ Module.ProductsBlockModel = base.BlockModel.extend({ titleIsLink: false, // false|true imageFullWidth: false, // true|false titlePosition: 'abovePost', // 'abovePost'|'aboveExcerpt' - featuredImagePosition: 'centered', // 'centered'|'right'|'left'|'alternate'|'none' + featuredImagePosition: 'alternate', // 'centered'|'right'|'left'|'alternate'|'none' pricePosition: 'hidden', // 'hidden'|'above'|'below' readMoreType: 'link', // 'link'|'button' readMoreText: 'Buy now', // 'link'|'button' diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 1bb4ae0725..8a20c02a4b 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -160,6 +160,12 @@ class AcceptanceTester extends \Codeception\Actor { expect($attributeValue)->contains($contains); } + public function assertAttributeNotContains($selector, $attribute, $notContains) { + $I = $this; + $attributeValue = $I->grabAttributeFrom($selector, $attribute); + expect($attributeValue)->notContains($notContains); + } + public function searchFor($query, $delay = 0, $element = '#search_input', $button = 'Search') { $I = $this; $I->waitForElement($element); diff --git a/tests/acceptance/EditorProductsCest.php b/tests/acceptance/EditorProductsCest.php index 11055ead22..7588e837b9 100644 --- a/tests/acceptance/EditorProductsCest.php +++ b/tests/acceptance/EditorProductsCest.php @@ -213,6 +213,28 @@ class EditorProductsCest { $I->clickLabelWithInput('mailpoet_posts_show_divider', 'false'); $this->waitForChange($I); $I->dontSeeElementInDOM(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_divider_block'); + + // Test "Image width" + $I->assertAttributeNotContains(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block', 'class', 'mailpoet_full_image'); + $I->clickLabelWithInput('imageFullWidth', 'true'); + $this->waitForChange($I); + $I->assertAttributeContains(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block', 'class', 'mailpoet_full_image'); + + // Test "Image position" + $I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(2) .mailpoet_image_block'); + $I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(4) .mailpoet_block:nth-child(1) .mailpoet_image_block'); + $I->clickLabelWithInput('mailpoet_products_featured_image_position', 'none'); + $this->waitForChange($I); + $I->dontSeeElementInDOM(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block'); + $I->clickLabelWithInput('mailpoet_products_featured_image_position', 'left'); + $this->waitForChange($I); + $I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(1) .mailpoet_image_block'); + $I->clickLabelWithInput('mailpoet_products_featured_image_position', 'right'); + $this->waitForChange($I); + $I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(2) .mailpoet_image_block'); + $I->clickLabelWithInput('mailpoet_products_featured_image_position', 'centered'); + $this->waitForChange($I); + $I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(1) .mailpoet_image_block'); } private function clearCategories(\AcceptanceTester $I) {