Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Constructor.io beacon data attribute to expose the current results page on PLP containers, and extends existing unit/component tests to validate it.
Changes:
- Added
data-cnstrc-result-pagetocnstrcDataAttrs.common. - Included the new
resultPageattribute in PLP container data attributes for both search and browse. - Updated utility + client/server component tests to assert the new attribute is rendered.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils/dataAttributeHelpers.ts |
Adds the resultPage attribute constant and emits it for search/browse PLP container attributes. |
spec/utils/dataAttributeHelpers.test.tsx |
Verifies getPlpContainerCnstrcDataAttributes includes resultPage. |
spec/components/CioPlpGrid/CioPlpGrid.test.jsx |
Verifies the client-rendered PLP container includes data-cnstrc-result-page. |
spec/components/CioPlpGrid/CioPlpGrid.server.test.jsx |
Verifies the server-rendered markup includes data-cnstrc-result-page. |
.gitignore |
Ignores IntelliJ .idea directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const { filterName, filterValue } = requestConfigs; | ||
| const pageType = getPageType(requestConfigs); | ||
| const isZeroResults = data.response.totalNumResults === 0; | ||
| const resultPage = requestConfigs.page || 1; |
| expect(resultId).toEqual(String(mockBrowseData.resultId)); | ||
| expect(filterName).toEqual(String(mockBrowseData.request.browse_filter_name)); | ||
| expect(filterValue).toEqual(String(mockBrowseData.request.browse_filter_value)); | ||
| expect(resultPage).toEqual(String(mockBrowseData.request.page.toString())); |
Code Review Results✅ StrengthsGood small, focused change with tests covering both browse and search page types, plus the server-side render path. 🚨 Critical Issues
|
Pull Request Checklist
Before you submit a pull request, please make sure you have to following:
PR Type
What kind of change does this PR introduce?