From 931531b69e93350c3c10b70126e3e1da4025575c Mon Sep 17 00:00:00 2001 From: Sanjay Rai Date: Wed, 24 Jul 2024 16:06:48 -0700 Subject: [PATCH 1/2] Add Opt-In Feature for CaaS Badge Display --- libs/blocks/caas-config/caas-config.js | 1 + libs/blocks/caas/utils.js | 1 + 2 files changed, 2 insertions(+) diff --git a/libs/blocks/caas-config/caas-config.js b/libs/blocks/caas-config/caas-config.js index a010c60df7..92b5b566c7 100644 --- a/libs/blocks/caas-config/caas-config.js +++ b/libs/blocks/caas-config/caas-config.js @@ -364,6 +364,7 @@ const UiPanel = () => html` <${Input} label="Use Overlay Links" prop="useOverlayLinks" type="checkbox" /> <${Input} label="Show total card count at top" prop="showTotalResults" type="checkbox" /> <${Input} label="Hide date for on-demand content" prop="hideDateInterval" type="checkbox" /> + <${Input} label="Enable showing card badges (by default hidden)" prop="showCardBadges" type="checkbox" /> <${Select} label="Card Style" prop="cardStyle" options=${defaultOptions.cardStyle} /> <${Select} options=${defaultOptions.cardTitleAccessibilityLevel} prop="cardTitleAccessibilityLevel" label="Card Accessibility Title Level" /> <${Select} label="Layout" prop="container" options=${defaultOptions.container} /> diff --git a/libs/blocks/caas/utils.js b/libs/blocks/caas/utils.js index 6155e2a58a..a6aad61031 100644 --- a/libs/blocks/caas/utils.js +++ b/libs/blocks/caas/utils.js @@ -580,6 +580,7 @@ export const getConfig = async (originalState, strs = {}) => { }&size=${state.collectionSize || state.totalCardsToShow}${localesQueryParam}${debug}${flatFile}`, fallbackEndpoint: state.fallbackEndpoint, totalCardsToShow: state.totalCardsToShow, + showCardBadges: state.showCardBadges, cardStyle: state.cardStyle, showTotalResults: state.showTotalResults, i18n: { From 547e097a3609a74b811840ee21bacc11c2ef716a Mon Sep 17 00:00:00 2001 From: Sanjay Rai Date: Thu, 25 Jul 2024 13:02:18 -0700 Subject: [PATCH 2/2] Updates for unit tests --- libs/blocks/caas/utils.js | 1 + test/blocks/caas-config/caas-config.test.html | 2 +- test/blocks/caas-config/expectedConfigs/defaultConfig.js | 1 + test/blocks/caas/utils.test.js | 3 +++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/blocks/caas/utils.js b/libs/blocks/caas/utils.js index a6aad61031..68ab6c5819 100644 --- a/libs/blocks/caas/utils.js +++ b/libs/blocks/caas/utils.js @@ -819,6 +819,7 @@ export const defaultState = { secondaryTags: [], secondarySource: [], setCardBorders: false, + showCardBadges: false, showFooterDivider: false, showBookmarksFilter: false, showBookmarksOnCards: false, diff --git a/test/blocks/caas-config/caas-config.test.html b/test/blocks/caas-config/caas-config.test.html index 0e6e76a227..fa0456dff4 100644 --- a/test/blocks/caas-config/caas-config.test.html +++ b/test/blocks/caas-config/caas-config.test.html @@ -312,7 +312,7 @@ // The header is the part before the first / in the hash // Due to this we only compare the characters after the header value - const hashWithoutHeader = 'bNhD9Lzw7Wafb9qDb2ruLGPBm3diLHoqgGJMjiTDFUcmhvUrR/16Q+nacm/TecL74ZvivAKU0a7JgvuI/AT3vwEHlRfbXt4UAC6ZhLf2ajEEZ7b5AhSITYkIeHMjTpqodeq/JiiwH4zEaqC0VWh6g6P0FpjUFy67Zgi0GyyPRqQJ32kiye4yR2hBT/M36CSPBqT03JuZSgsk/lKiLkjvmoNngg5QxoaM2mpstntGI7PeFkEMpK7a9i9rpClwjpvRY6Yglx9fgXn8fMMugLTqRiU+/LJcv8P6nVlx2FFo+NDWO/ZBtL0QmJIDPut+74OOB4JmqNTjV+WZ4SOFEJv72aHKxEIq+EG/he7MlUEM3lfZwNLgCa9H5EXaQ8+Nx+EeratI2NvRyuXwERUf8KKm6k6Wu0MEHqPXdWKWIJ87aka3QdreA79IEhSpm2ZXUQWONORhzBHl6GsOJhcgROLjZyVwbRvd0Hry3wCpoo3Zg4/UlAVXAWg70liR0XTGY8wQvtBSZIDdAszh+nfo7g/YlXZ6qmpuhR0VgTrf567tYiBJBDW5KrXDNsFHz/7HwCDwC48YyujOYwam2Vy0yYIsABfY66P/vMHbdQEMhCSfmEeoI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/S5amquRk0KgJzquav72IhSgQ1mCm1wjXDRs3/x8Qj8AiMG8vozmAGo9peSWTAFgEK7Pug/7/DqLqBhkJqnBhHqCNEoF7I4c0OtsRXY0fWNDG3VTdOg+xdQOSuLtRQaJtkfbC6Sh+DHyhQiemRJxu7bWy/kfkjgGXNybe9wXc5dUCq1Ei+eTyUWOH9eNGAxJKMQvfmTNsjDn0w7HfodknA3xbCIzhZPms0fWk8SrIKXDNmOEB7Ck5iD3IUZkVOTQfHl3RJOKgC5/AzEaN71GetYptMmF5r/5x66zb3aueFSCb7Xp1gm6sz+5TiDDoQxxWe1BgJchxb8MHLH7BHvAG+kNK5nhQzEZhDMHEoVX+vJdrK76gO9exCi38Fq6jaQ1UbPdn16UAc8j05nqHP3U6YgX1E1yn0+A9ptG7nEHp0Z9JuR2RE9mm5XF4RKUoU2X2Lt+/HleEEXrnrekeUcDl58W0hGArfNufPd2o8I+JRVyDHnX7WceWIAbueKI5zEBdcfOLQxyWnkEEbf8B3fq27/ae6Oi0Ex1A/Iyhti+7lE+V9JGKXpJ47UJzKKMZCBI/baDpaG5wGj69ndAaarbansacm72dgphsLKHh0G5tTHKr//gcEWd70YggAAA=='; const hash = copyTextArea.value.split('#')[1].trim(); diff --git a/test/blocks/caas-config/expectedConfigs/defaultConfig.js b/test/blocks/caas-config/expectedConfigs/defaultConfig.js index afaed3b076..0e9b72de15 100644 --- a/test/blocks/caas-config/expectedConfigs/defaultConfig.js +++ b/test/blocks/caas-config/expectedConfigs/defaultConfig.js @@ -26,6 +26,7 @@ const defaultConfig = { }, detailsTextOption: 'default', setCardBorders: false, + showCardBadges: false, showFooterDivider: false, useOverlayLinks: false, banner: { diff --git a/test/blocks/caas/utils.test.js b/test/blocks/caas/utils.test.js index 04a1b300a0..be7df8253f 100644 --- a/test/blocks/caas/utils.test.js +++ b/test/blocks/caas/utils.test.js @@ -186,6 +186,7 @@ describe('getConfig', () => { titleHeadingLevel: 'h3', }, setCardBorders: false, + showCardBadges: false, showFooterDivider: false, useOverlayLinks: false, additionalRequestParams: {}, @@ -448,6 +449,7 @@ describe('getConfig', () => { titleHeadingLevel: 'h3', }, setCardBorders: false, + showCardBadges: false, showFooterDivider: false, useOverlayLinks: false, additionalRequestParams: {}, @@ -771,6 +773,7 @@ describe('getFloodgateCaasConfig', () => { titleHeadingLevel: 'h3', }, setCardBorders: false, + showCardBadges: false, showFooterDivider: false, useOverlayLinks: false, additionalRequestParams: {},