Skip to content

Commit

Permalink
Merge pull request #724 from Financial-Times/ENTST-547-fix-highlights…
Browse files Browse the repository at this point in the history
…-checkbox-issue

fix: highlights checkbox displaying when highlights are not selected
  • Loading branch information
joelcarr authored Jul 7, 2023
2 parents ff277bc + ff39525 commit 93a50ef
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion components/x-gift-article/__tests__/x-gift-article.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const baseArgs = {
title: 'Equinor and Daimler Truck cut Russia ties as Volvo and JLR halt car deliveries'
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: true
}

describe('x-gift-article', () => {
Expand Down
5 changes: 3 additions & 2 deletions components/x-gift-article/src/v2/AdvancedSharingOptions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const AdvancedSharingOptions = (props) => {
includeHighlights,
enterpriseHasCredits,
giftCredits,
showHighlightsRecipientMessage
showHighlightsRecipientMessage,
hasHighlights
} = props
const onValueChange = (event) => {
if (event.target.value === ShareType.enterprise) {
Expand Down Expand Up @@ -69,7 +70,7 @@ export const AdvancedSharingOptions = (props) => {
</NoCreditAlert>
)}
{showHighlightsRecipientMessage && <ReceivedHighlightsAlert {...props} />}
{showHighlightsCheckbox && (
{showHighlightsCheckbox && hasHighlights && (
<div className="o-forms-input o-forms-input--checkbox o-forms-field share-article-dialog__include-highlights">
<label htmlFor="includeHighlights">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ exports.args = {
title: 'Equinor and Daimler Truck cut Russia ties as Volvo and JLR halt car deliveries'
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: true
}

exports.fetchMock = (fetchMock) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ exports.args = {
title: 'Equinor and Daimler Truck cut Russia ties as Volvo and JLR halt car deliveries'
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: true
}

exports.fetchMock = (fetchMock) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ exports.args = {
title: 'Equinor and Daimler Truck cut Russia ties as Volvo and JLR halt car deliveries'
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: true
}

exports.fetchMock = (fetchMock) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports.args = {
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: false,
showHighlightsCheckbox: false,
showHighlightsRecipientMessage: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ exports.args = {
title: 'Equinor and Daimler Truck cut Russia ties as Volvo and JLR halt car deliveries'
},
id: 'base-gift-article-static-id',
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`
enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com`,
hasHighlights: true
}

exports.fetchMock = (fetchMock) => {
Expand Down

0 comments on commit 93a50ef

Please sign in to comment.