Skip to content

Commit

Permalink
Merge pull request #2556 from magento-honey-badgers/MAGETWO-91580-Emp…
Browse files Browse the repository at this point in the history
…ty-product-attributes-of-dropdown

[honey] Bug fixes
  • Loading branch information
cpartica authored May 18, 2018
2 parents fb4294a + 25b2780 commit e65dac4
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
?>
<?php $_total = $block->getItems()->getSize() ?>
<?php if ($_total): ?>
<a href="#" class="action print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
<a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
<span><?= /* @escapeNotVerified */ __('Print This Page') ?></span>
</a>
<div class="table-wrapper comparison">
Expand All @@ -29,7 +29,7 @@
<?php if ($_i++ == 0): ?>
<th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th>
<?php endif; ?>
<td class="cell remove product">
<td class="cell remove product hidden-print">
<?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?>
<a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($_item) ?>'
class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>">
Expand Down Expand Up @@ -59,7 +59,7 @@
</strong>
<?= $block->getReviewsSummaryHtml($_item, 'short') ?>
<?= /* @escapeNotVerified */ $block->getProductPrice($_item, '-compare-list-top') ?>
<div class="product-item-actions">
<div class="product-item-actions hidden-print">
<div class="actions-primary">
<?php if ($_item->isSaleable()): ?>
<form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item) ?>" method="post">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function getValue(\Magento\Framework\DataObject $object)
$options = $opt->getAllOptions();
if ($options) {
foreach ($options as $option) {
if ($option['value'] == $value) {
if ($option['value'] === $value) {
$valueOption = $option['label'];
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/design/frontend/Magento/blank/web/css/print.less
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@
.footer.content {
padding: 0;
}

.hidden-print {
display: none !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,25 @@
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
<entity name="productAttributeWithDropdownTwoOptions" type="ProductAttribute">
<data key="attribute_code">testattribute</data>
<data key="frontend_input">select</data>
<data key="scope">global</data>
<data key="is_required">false</data>
<data key="is_unique">false</data>
<data key="is_searchable">true</data>
<data key="is_visible">true</data>
<data key="is_visible_in_advanced_search">true</data>
<data key="is_visible_on_front">true</data>
<data key="is_filterable">true</data>
<data key="is_filterable_in_search">true</data>
<data key="used_in_product_listing">true</data>
<data key="is_used_for_promo_rules">true</data>
<data key="is_comparable">true</data>
<data key="is_used_in_grid">true</data>
<data key="is_visible_in_grid">true</data>
<data key="is_filterable_in_grid">true</data>
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<data key="visibility">4</data>
<data key="status">1</data>
<data key="quantity">1000</data>
<data key="urlKey" unique="suffix">simpleproduct</data>
<data key="weight">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="StorefrontProductWithEmptyAttributeTest">
<annotations>
<title value="Product attribute is not visible on storefront if it is empty"/>
<description value="Product attribute should not be visible on storefront if it is empty"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-91893"/>
<group value="product"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createProductAttribute"/>
</before>
<after>
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteSimpleProduct">
<argument name="product" value="SimpleProduct"/>
</actionGroup>
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
</after>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="amOnAttributeSetPage"/>
<click selector="{{AdminProductAttributeSetGridSection.AttributeSetName('Default')}}" stepKey="chooseDefaultAttributeSet"/>
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
<dragAndDrop selector1="{{UnassignedAttributes.ProductAttributeName('testattribute')}}" selector2="{{Group.FolderName('Product Details')}}" stepKey="moveProductAttributeToGroup"/>
<click selector="{{AttributeSetSection.Save}}" stepKey="saveAttributeSet"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear" />
<seeElement selector=".message-success" stepKey="assertSuccess"/>
<actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin">
<argument name="category" value="$$createPreReqCategory$$"/>
<argument name="simpleProduct" value="SimpleProduct"/>
</actionGroup>
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCache"/>
<amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="goProductPageOnStorefront"/>
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
<dontSeeElement selector="//table[@id='product-attribute-specs-table']/tbody/tr/th[contains(text(),'testattribute')]" stepKey="seeAttribute2"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
<page name="ThemesPageIndex" url="admin/system_design_theme/" area="admin" module="Magento_Theme">
<section name="AdminThemeSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminThemeSection">
<!--All rows in a specific Column e.g. {{Section.rowsInColumn('columnName')}}-->
<element name="rowsInColumn" type="text" selector="//tr/td[contains(@class, '{{column}}')]" parameterized="true"/>
<!--selector for Theme Title column since it needs to be handled separately-->
<element name="rowsInThemeTitleColumn" type="text" selector="//tbody/tr/td[contains(@class, 'parent_theme')]/preceding-sibling::td"/>
<element name="rowsInColumn" type="text" selector="//tbody/tr/td[contains(@class, '{{column}}')]" parameterized="true"/>
<!--Specific cell e.g. {{Section.gridCell('Name')}}-->
<element name="gridCell" type="text" selector="//table[@id='theme_grid_table']//td[contains(text(), '{{gridCellText}}')]" parameterized="true"/>
<element name="columnHeader" type="text" selector="//thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
<test name="ThemeTest">
<annotations>
<features value="Theme Test"/>
<title value="Magento Rush theme should not be available in Themes grid"/>
<description value="Magento Rush theme should not be available in Themes grid"/>
<severity value="MAJOR"/>
<testCaseId value="MAGETWO-91409"/>
<group value="theme"/>
</annotations>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
</after>
<!--Login to Admin Area-->
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/>
<!--Navigate to Themes page-->
<amOnPage url="{{ThemesPageIndex.url}}" stepKey="navigateToThemesIndexPage" />
<waitForPageLoad stepKey="wait1"/>
<dontSee selector="{{AdminThemeSection.gridCell('Magento Rush')}}" stepKey="dontSeeRushThemeInTitleColumn"/>
<seeNumberOfElements selector="{{AdminThemeSection.rowsInColumn('theme_path')}}" userInput="2" stepKey="see2RowsOnTheGrid"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
'is_filterable_in_search' => 0,
'is_used_for_promo_rules' => 0,
'is_html_allowed_on_front' => 1,
'is_visible_on_front' => 0,
'used_in_product_listing' => 0,
'is_visible_on_front' => 1,
'used_in_product_listing' => 1,
'used_for_sort_by' => 0,
'frontend_label' => ['Drop-Down Attribute'],
'backend_type' => 'varchar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ public function testGetSelectOptions()
);
}

/**
* @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php
*/
public function testAttributeEntityValueNotSet()
{
$entity = $this->objectManager->create(\Magento\Catalog\Model\Product::class);
$entity->setStoreId(0);
$entity->load(1);
$frontEnd = $this->attribute->loadByCode('catalog_product', 'dropdown_attribute');
$value = $frontEnd->getFrontend()->getValue($entity);
$this->assertFalse($value);
}

/**
* Cache key generation
* @return string
Expand Down

0 comments on commit e65dac4

Please sign in to comment.