Skip to content

Commit 1aa12af

Browse files
committed
ACP2E-111: Inconsistent product rating on category page
1 parent f32b47b commit 1aa12af

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

app/code/Magento/Review/Test/Mftf/Test/StoreFrontReviewRatingByCustomerTest.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,14 @@
126126
<actualResult type="string">$getProductPriceStarsAtUserAccount</actualResult>
127127
<expectedResult type="string">width: 100%;</expectedResult>
128128
</assertEquals>
129+
130+
<!-- Navigate to customer/account/ and check My Recent Reviews-->
131+
<amOnPage url="customer/account/" stepKey="amOnCustomerDashboardMyRecentReview"/>
132+
<waitForPageLoad stepKey="waitForSchedulePageLoad" time="120"/>
133+
<grabAttributeFrom selector="div.rating-result>span.rating_$$createProduct1.id$$ span" userInput="style" stepKey="getProductStarsAtListView2"/>
134+
<assertEquals stepKey="checkProductStarsAtCustomerDashboard">
135+
<actualResult type="string">$getProductStarsAtListView2</actualResult>
136+
<expectedResult type="string">width: 80%;</expectedResult>
137+
</assertEquals>
129138
</test>
130139
</tests>

app/code/Magento/Review/view/frontend/templates/customer/recent.phtml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,15 @@
3030
<?php if ($_review->getSum()): ?>
3131
<?php $rating = $_review->getSum() / $_review->getCount() ?>
3232
<div class="rating-summary">
33-
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
34-
<div class="rating-result"
35-
id="rating-result_<?= /* @noEscape */ $block->escapeHtml($_review->getId()) ?>"
36-
title="<?= $block->escapeHtmlAttr($rating) ?>%">
37-
<span>
38-
<span><?= $block->escapeHtml($rating) ?>%</span>
33+
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
34+
<div class="rating-result" title="<?= $escaper->escapeHtmlAttr($rating) ?>%">
35+
<span class="rating_<?= $escaper->escapeUrl($_review->getReviewId())?>">
36+
<span><?= $escaper->escapeHtml($rating) ?>%</span>
3937
</span>
4038
</div>
41-
<?= /* @noEscape */
42-
$secureRenderer->renderStyleAsTag(
43-
"width:" . $block->escapeHtmlAttr($rating) . "%",
44-
'#rating-result_' . $block->escapeHtml($_review->getId()) . ' span'
39+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
40+
"width:". $escaper->escapeHtmlAttr($rating) . "%",
41+
'div.rating-result>span.rating_' . $escaper->escapeUrl($_review->getReviewId())
4542
) ?>
4643
</div>
4744
<?php endif; ?>

0 commit comments

Comments
 (0)