Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions apps/web/e2e/selector-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ test('leaderboard selectors expose their state', async ({ page }) => {
const groups = [
page.getByRole('group', { name: 'Chọn ngành hàng' }),
page.getByRole('group', { name: /Xếp hạng theo tiêu chí/ }),
page.getByRole('group', { name: /Gợi ý theo nhu cầu/ }),
page.getByRole('group', { name: 'Lọc theo tầm giá' }),
];
for (const group of groups) {
Expand All @@ -22,33 +21,35 @@ test('leaderboard selectors expose their state', async ({ page }) => {
);

// Choosing a price segment moves the pressed state.
const price = groups[3]!;
const price = groups[2]!;
const unpressed = price.getByRole('button', { pressed: false }).first();
const label = (await unpressed.innerText()).trim();
await unpressed.click();
await expect(price.getByRole('button', { pressed: true })).toHaveText(label);
});

// The customize button reports the weight panel it opens.
const customize = page.locator(
'button[aria-controls="leaderboard-weight-sliders"]'
);
await expect(customize).toHaveAttribute('aria-expanded', 'false');
await customize.click();
await expect(customize).toHaveAttribute('aria-expanded', 'true');
await expect(page.locator('#leaderboard-weight-sliders')).toBeVisible();

// Moving a slider makes the weights custom: no preset is pressed, and the
// customize button, coloured for it, says so in its name.
await expect(customize).not.toHaveAccessibleName(/Trọng số cá nhân hóa/);
const slider = page
.locator('#leaderboard-weight-sliders input[type="range"]')
.first();
await slider.focus();
await page.keyboard.press('ArrowRight');
await expect(customize).toHaveAccessibleName(/Trọng số cá nhân hóa/);
await expect(groups[2]!.getByRole('button', { pressed: true })).toHaveCount(
0
// No seeded product has a criterion score, as on rate.vn today: the criterion
// tabs, the persona presets and the weight sliders would only empty the list,
// so they are not shown, and a criterion URL opens on the combined score
// (DOS/Rate#1553).
test('criteria with no scored product get no tab or persona', async ({
page,
}) => {
expect(
(await page.goto('/leaderboard?cat=smartphones&criterion=camera'))?.status()
).toBe(200);
const criteria = page.getByRole('group', { name: /Xếp hạng theo tiêu chí/ });
await expect(criteria.getByRole('button')).toHaveCount(3);
await expect(criteria.getByRole('button', { pressed: true })).toContainText(
'Điểm tổng hợp'
);
await expect(page).toHaveURL(/[?&]criterion=combined$/);
await expect(
page.getByRole('group', { name: /Gợi ý theo nhu cầu/ })
).toHaveCount(0);
await expect(
page.locator('button[aria-controls="leaderboard-weight-sliders"]')
).toHaveCount(0);
});

test('the compare category switcher exposes its state', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
"updatingLabTestsDesc": "Dokud není k dispozici expertní skóre, celkové skóre vychází jen ze skutečných hodnocení kupujících (bez falešných recenzí).",
"expertReviewsCountNote": "{count, plural, one {# expertní hodnocení} few {# expertní hodnocení} other {# expertních hodnocení}}",
"zeroAdDilutionNote": "Nezkresleno reklamními recenzemi",
"criteriaMatrixHeading": "Podrobné skóre v 5 oblastech zkušeností",
"criteriaMatrixHeading": "Podrobné skóre podle oblastí zkušeností",
"normalizedByHelpfulnessBadge": "Normalizováno podle váhy užitečnosti",
"notAvailableShort": "N/A",
"aiAuthenticityHeading": "AI analýza důvěryhodnosti a souhrn zkušeností",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
"updatingLabTestsDesc": "Until the expert score is ready, the combined score uses only genuine buyer ratings (fake reviews filtered out).",
"expertReviewsCountNote": "{count, plural, one {# expert evaluation} other {# expert evaluations}}",
"zeroAdDilutionNote": "Undiluted by sponsored or affiliate reviews",
"criteriaMatrixHeading": "Scores across 5 experience criteria",
"criteriaMatrixHeading": "Scores by experience criterion",
"normalizedByHelpfulnessBadge": "Normalized by helpfulness weight",
"notAvailableShort": "N/A",
"aiAuthenticityHeading": "AI review authenticity check and experience summary",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
"updatingLabTestsDesc": "Khi chưa có điểm chuyên gia, điểm tổng hợp chỉ dựa trên đánh giá của người mua thực chất (đã lọc đánh giá ảo).",
"expertReviewsCountNote": "{count} bài đánh giá từ chuyên gia",
"zeroAdDilutionNote": "Chưa bị pha loãng bởi đánh giá quảng cáo",
"criteriaMatrixHeading": "Điểm chi tiết theo 5 tiêu chí trải nghiệm",
"criteriaMatrixHeading": "Điểm chi tiết theo tiêu chí trải nghiệm",
"normalizedByHelpfulnessBadge": "Đã chuẩn hóa theo trọng số hữu ích",
"notAvailableShort": "Chưa có",
"aiAuthenticityHeading": "AI kiểm tra đánh giá thật hay ảo và tóm tắt trải nghiệm",
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/app/[locale]/smartphones/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import {
import {
firstImageUrl,
foreignCategoryProductHref,
isCanonicalCategorySlug,
usableImageUrls,
productImageUrl,
storeImageSrcSet,
Expand Down Expand Up @@ -1434,6 +1435,9 @@ export async function ProductDetailView({
<div className="mb-5">
<JReviewsSection
masterProductId={product.id}
categorySlug={
isCanonicalCategorySlug(categorySlug) ? categorySlug : undefined
}
productSlug={product.slug}
productName={product.name}
averageRating={normalizeCompareFiveStarRating(
Expand Down
Loading
Loading