Skip to content

Commit 2712e5b

Browse files
authored
@W-19053749: Removed edit button for auto-bonus products (#2815)
* Removed edit button for auto-bonus products * removed extra comments * Fixed lint issues
1 parent 9626b15 commit 2712e5b

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

packages/template-retail-react-app/app/pages/cart/partials/cart-secondary-button-group.jsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,14 @@ const CartSecondaryButtonGroup = ({
104104
/>
105105
</Button>
106106
)}
107-
{/* Only show edit button if it's not a standard product */}
108-
{variant.id &&
109-
!variant.type?.item && ( // the variant.id ensures complete product data. Without it, Edit button appears briefly
110-
<Button variant="link" size="sm" onClick={() => onEditClick(variant)}>
111-
<FormattedMessage
112-
defaultMessage="Edit"
113-
id="cart_secondary_button_group.action.edit"
114-
/>
115-
</Button>
116-
)}
107+
{variant.id && !variant.type?.item && !isBonusProduct && (
108+
<Button variant="link" size="sm" onClick={() => onEditClick(variant)}>
109+
<FormattedMessage
110+
defaultMessage="Edit"
111+
id="cart_secondary_button_group.action.edit"
112+
/>
113+
</Button>
114+
)}
117115
</ButtonGroup>
118116
{!isBonusProduct && (
119117
<Flex alignItems="center">

packages/template-retail-react-app/app/pages/cart/partials/cart-secondary-button-group.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@ describe('CartSecondaryButtonGroup Edit button conditional rendering', () => {
170170
})
171171
})
172172

173-
test('hides remove, wishlist and gift checkbox for bonus product', async () => {
173+
test('hides remove, wishlist, edit button and gift checkbox for bonus product', async () => {
174174
const {user} = renderWithProviders(<MockedComponent isBonusProduct={true} />)
175175

176-
expect(screen.getByRole('button', {name: /edit/i})).toBeInTheDocument()
177-
176+
expect(screen.queryByRole('button', {name: /edit/i})).not.toBeInTheDocument()
178177
expect(screen.queryByRole('button', {name: /remove/i})).not.toBeInTheDocument()
179178
expect(screen.queryByRole('button', {name: /add to wishlist/i})).not.toBeInTheDocument()
180179
expect(screen.queryByRole('checkbox', {name: /this is a gift/i})).not.toBeInTheDocument()

0 commit comments

Comments
 (0)