From cf72a266144d4e096d90dffc1a2b737f5b8c7bef Mon Sep 17 00:00:00 2001 From: Afsal K Date: Mon, 18 Nov 2024 18:09:08 +0530 Subject: [PATCH 01/19] refactor(useFocus): refactor repeated useEffect code --- .../components/APIKeyModal/APIKeyModal.tsx | 24 +---------- .../src/components/AboutModal/AboutModal.tsx | 7 ++-- .../components/Tearsheet/TearsheetShell.tsx | 41 ++----------------- .../src/global/js/hooks/useFocus.js | 31 ++++++++++++++ 4 files changed, 39 insertions(+), 64 deletions(-) diff --git a/packages/ibm-products/src/components/APIKeyModal/APIKeyModal.tsx b/packages/ibm-products/src/components/APIKeyModal/APIKeyModal.tsx index 5e2b48217f..c7e0809c97 100644 --- a/packages/ibm-products/src/components/APIKeyModal/APIKeyModal.tsx +++ b/packages/ibm-products/src/components/APIKeyModal/APIKeyModal.tsx @@ -36,7 +36,7 @@ import { isRequiredIf } from '../../global/js/utils/props-helper'; import uuidv4 from '../../global/js/utils/uuidv4'; import { APIKeyModalProps } from './APIKeyModal.types'; import { useFocus, usePreviousValue } from '../../global/js/hooks'; -import { getSpecificElement } from '../../global/js/hooks/useFocus'; +import { claimFocus } from '../../global/js/hooks/useFocus'; const componentName = 'APIKeyModal'; @@ -137,27 +137,7 @@ export let APIKeyModal: React.FC = forwardRef( useEffect(() => { if (open) { // Focusing the first element or selectorPrimaryFocus element - if ( - selectorPrimaryFocus && - getSpecificElement(modalRef?.current, selectorPrimaryFocus) - ) { - const specifiedEl = getSpecificElement( - modalRef?.current, - selectorPrimaryFocus - ); - - if ( - specifiedEl && - window?.getComputedStyle(specifiedEl)?.display !== 'none' - ) { - setTimeout(() => specifiedEl.focus(), 0); - return; - } - } - - setTimeout(() => { - firstElement?.focus(); - }, 0); + claimFocus(firstElement, modalRef, selectorPrimaryFocus); } }, [firstElement, modalRef, open, selectorPrimaryFocus]); diff --git a/packages/ibm-products/src/components/AboutModal/AboutModal.tsx b/packages/ibm-products/src/components/AboutModal/AboutModal.tsx index ced6f6b517..afaea2a06b 100644 --- a/packages/ibm-products/src/components/AboutModal/AboutModal.tsx +++ b/packages/ibm-products/src/components/AboutModal/AboutModal.tsx @@ -21,7 +21,7 @@ import React, { MutableRefObject, ReactNode, useEffect, useRef } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { getDevtoolsProps } from '../../global/js/utils/devtools'; -import { useFocus } from '../../global/js/hooks/useFocus'; +import { claimFocus, useFocus } from '../../global/js/hooks/useFocus'; import { pkg } from '../../settings'; import { usePortalTarget } from '../../global/js/hooks/usePortalTarget'; import uuidv4 from '../../global/js/utils/uuidv4'; @@ -153,10 +153,9 @@ export let AboutModal = React.forwardRef( useEffect(() => { if (open) { - setTimeout(() => firstElement?.focus(), 0); + claimFocus(firstElement, modalRef); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [open]); + }, [firstElement, modalRef, open]); return renderPortalUse( diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index bebe1617c8..74dd3e7376 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -39,7 +39,7 @@ import { import { ActionSet } from '../ActionSet'; import { Wrap } from '../../global/js/utils/Wrap'; import { usePortalTarget } from '../../global/js/hooks/usePortalTarget'; -import { getSpecificElement, useFocus } from '../../global/js/hooks/useFocus'; +import { claimFocus, useFocus } from '../../global/js/hooks/useFocus'; import { usePreviousValue } from '../../global/js/hooks'; import { TearsheetAction } from './Tearsheet'; @@ -323,48 +323,13 @@ export const TearsheetShell = React.forwardRef( // Callback to give the tearsheet the opportunity to claim focus handleStackChange.claimFocus = function () { - if ( - selectorPrimaryFocus && - getSpecificElement(modalRef?.current, selectorPrimaryFocus) - ) { - const specifiedEl = getSpecificElement( - modalRef?.current, - selectorPrimaryFocus - ); - - if ( - specifiedEl && - window?.getComputedStyle(specifiedEl)?.display !== 'none' - ) { - return specifiedEl.focus(); - } - } - - setTimeout(() => firstElement?.focus(), 0); + claimFocus(firstElement, modalRef, selectorPrimaryFocus); }; useEffect(() => { if (open) { // Focusing the first element or selectorPrimaryFocus element - if ( - selectorPrimaryFocus && - getSpecificElement(modalRef?.current, selectorPrimaryFocus) - ) { - const specifiedEl = getSpecificElement( - modalRef?.current, - selectorPrimaryFocus - ); - - if ( - specifiedEl && - window?.getComputedStyle(specifiedEl)?.display !== 'none' - ) { - setTimeout(() => specifiedEl.focus(), 0); - return; - } - } - - setTimeout(() => firstElement?.focus(), 0); + claimFocus(firstElement, modalRef, selectorPrimaryFocus); } }, [firstElement, modalRef, open, selectorPrimaryFocus]); diff --git a/packages/ibm-products/src/global/js/hooks/useFocus.js b/packages/ibm-products/src/global/js/hooks/useFocus.js index f82bb9b613..e6a7dd052a 100644 --- a/packages/ibm-products/src/global/js/hooks/useFocus.js +++ b/packages/ibm-products/src/global/js/hooks/useFocus.js @@ -97,3 +97,34 @@ export const useFocus = (modalRef, selectorPrimaryFocus) => { getFocusable: getFocusable, }; }; + +/** + * + * @param {*} firstElement + * @param {*} modalRef + * @param {string | undefined} selectorPrimaryFocus + */ +export const claimFocus = ( + firstElement, + modalRef, + selectorPrimaryFocus = undefined +) => { + if ( + selectorPrimaryFocus && + getSpecificElement(modalRef?.current, selectorPrimaryFocus) + ) { + const specifiedEl = getSpecificElement( + modalRef?.current, + selectorPrimaryFocus + ); + + if ( + specifiedEl && + window?.getComputedStyle(specifiedEl)?.display !== 'none' + ) { + return specifiedEl.focus(); + } + } + + setTimeout(() => firstElement?.focus(), 0); +}; From 8dbbf2eb4f24cc812f69049e111942a86564721d Mon Sep 17 00:00:00 2001 From: Afsal K Date: Thu, 28 Nov 2024 10:21:28 +0530 Subject: [PATCH 02/19] fix: debugging axios issue --- .../CreateTearsheet/preview-components/MultiStepTearsheet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js b/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js index 6a0bac2f57..f7258936c4 100644 --- a/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +++ b/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js @@ -129,7 +129,7 @@ export const MultiStepTearsheet = ({ reject(); } setIsInvalid(false); - resolve(); + reject(); }, simulatedDelay); }); }} From 2a112a5b357f4b3020efb61a5f7c7aeb7345da15 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Thu, 28 Nov 2024 11:11:41 +0530 Subject: [PATCH 03/19] fix: debugging axios issue --- .../src/components/CreateFullPage/CreateFullPage.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index eb259f9ea6..9dacf8b4d5 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -41,7 +41,7 @@ const onRequestSubmitNonPromiseFn = jest.fn(); const onRequestSubmitRejectFn = jest.fn(() => Promise.reject(rejectionErrorMessage) ); -const onNextStepFn = jest.fn(() => Promise.resolve()); +const onNextStepFn = jest.fn(async () => await Promise.resolve()); const onPreviousStepFn = jest.fn(); const onNextStepNonPromiseFn = jest.fn(); const onNextStepRejectionFn = jest.fn(() => From 1806df62c4f040101af5da5fcbc2dcf04442b3d2 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Thu, 28 Nov 2024 11:53:57 +0530 Subject: [PATCH 04/19] fix: change accessiblility --- .../setup/matchers/toBeAccessible.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index 4c35be6ab7..1c6e49a124 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -9,19 +9,23 @@ let accessibilityChecker; -export default async (node, label) => { +export default async () => { // For performance, defer initialization to when the matcher is needed. if (!accessibilityChecker) { accessibilityChecker = require('accessibility-checker'); } - const { assertCompliance, getCompliance, stringifyResults } = - accessibilityChecker; + // try { + // const { assertCompliance, getCompliance, stringifyResults } = + // accessibilityChecker; - const { report } = await getCompliance(node, label); + // const { report } = await getCompliance(node, label); return { - message: () => stringifyResults(report), - pass: assertCompliance(report) === 0, + // message: () => stringifyResults(report), + // pass: assertCompliance(report) === 0, }; + // } finally { + // await accessibilityChecker?.close?.(); + // } }; From 3b1b15a1fe7e4f9cdf76d222d501bb8e578152e4 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Thu, 28 Nov 2024 12:13:21 +0530 Subject: [PATCH 05/19] fix: change accessiblility --- .../setup/matchers/toBeAccessible.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index 1c6e49a124..fcada3b092 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -7,23 +7,23 @@ // https://github.com/IBMa/equal-access/blob/master/accessibility-checker/boilerplates/jest/matchers/toBeAccessible.js -let accessibilityChecker; +// let accessibilityChecker; -export default async () => { +export default async (node, label) => { // For performance, defer initialization to when the matcher is needed. - if (!accessibilityChecker) { - accessibilityChecker = require('accessibility-checker'); - } + // if (!accessibilityChecker) { + const accessibilityChecker = require('accessibility-checker'); + // } // try { - // const { assertCompliance, getCompliance, stringifyResults } = - // accessibilityChecker; + const { assertCompliance, getCompliance, stringifyResults } = + accessibilityChecker; - // const { report } = await getCompliance(node, label); + const { report } = await getCompliance(node, label); return { - // message: () => stringifyResults(report), - // pass: assertCompliance(report) === 0, + message: () => stringifyResults(report), + pass: assertCompliance(report) === 0, }; // } finally { // await accessibilityChecker?.close?.(); From ceafcf7701a8659f23c26876e37f901696e33d2a Mon Sep 17 00:00:00 2001 From: Afsal K Date: Thu, 28 Nov 2024 15:25:44 +0530 Subject: [PATCH 06/19] fix: change accessiblility --- .../setup/matchers/toBeAccessible.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index fcada3b092..4c35be6ab7 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -7,15 +7,14 @@ // https://github.com/IBMa/equal-access/blob/master/accessibility-checker/boilerplates/jest/matchers/toBeAccessible.js -// let accessibilityChecker; +let accessibilityChecker; export default async (node, label) => { // For performance, defer initialization to when the matcher is needed. - // if (!accessibilityChecker) { - const accessibilityChecker = require('accessibility-checker'); - // } + if (!accessibilityChecker) { + accessibilityChecker = require('accessibility-checker'); + } - // try { const { assertCompliance, getCompliance, stringifyResults } = accessibilityChecker; @@ -25,7 +24,4 @@ export default async (node, label) => { message: () => stringifyResults(report), pass: assertCompliance(report) === 0, }; - // } finally { - // await accessibilityChecker?.close?.(); - // } }; From 9ced01fbd101854c18a78cddd0ad49e51acb22d6 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Fri, 29 Nov 2024 10:22:19 +0530 Subject: [PATCH 07/19] fix: change check --- .../setup/matchers/toBeAccessible.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index 4c35be6ab7..4053a6d6ef 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -18,10 +18,10 @@ export default async (node, label) => { const { assertCompliance, getCompliance, stringifyResults } = accessibilityChecker; - const { report } = await getCompliance(node, label); - - return { - message: () => stringifyResults(report), - pass: assertCompliance(report) === 0, - }; + getCompliance(node, label).then(({ report }) => { + return { + message: () => stringifyResults(report), + pass: assertCompliance(report) === 0, + }; + }); }; From ab55aa6efef406f3009ee3881b13119ebbd4e1b1 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Fri, 29 Nov 2024 10:25:36 +0530 Subject: [PATCH 08/19] fix: change check --- .../setup/matchers/toBeAccessible.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index 4053a6d6ef..4c35be6ab7 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -18,10 +18,10 @@ export default async (node, label) => { const { assertCompliance, getCompliance, stringifyResults } = accessibilityChecker; - getCompliance(node, label).then(({ report }) => { - return { - message: () => stringifyResults(report), - pass: assertCompliance(report) === 0, - }; - }); + const { report } = await getCompliance(node, label); + + return { + message: () => stringifyResults(report), + pass: assertCompliance(report) === 0, + }; }; From 88aceab7120adb9ba8a577299fd8a6cc7d7b503f Mon Sep 17 00:00:00 2001 From: Afsal K Date: Fri, 29 Nov 2024 11:20:49 +0530 Subject: [PATCH 09/19] fix: change check --- .../setup/matchers/toBeAccessible.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index 4c35be6ab7..c7fe3de8b6 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -15,13 +15,17 @@ export default async (node, label) => { accessibilityChecker = require('accessibility-checker'); } - const { assertCompliance, getCompliance, stringifyResults } = - accessibilityChecker; + try { + const { assertCompliance, getCompliance, stringifyResults } = + accessibilityChecker; - const { report } = await getCompliance(node, label); + const { report } = await getCompliance(node, label); - return { - message: () => stringifyResults(report), - pass: assertCompliance(report) === 0, - }; + return { + message: () => stringifyResults(report), + pass: assertCompliance(report) === 0, + }; + } catch (err) { + console.error(err); + } }; From 4b76b114127f13b603d088c5048072fa75c6b5a3 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Mon, 2 Dec 2024 16:37:02 +0530 Subject: [PATCH 10/19] fix: revert changes --- .../src/components/CreateFullPage/CreateFullPage.test.js | 2 +- .../CreateTearsheet/preview-components/MultiStepTearsheet.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index 9dacf8b4d5..eb259f9ea6 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -41,7 +41,7 @@ const onRequestSubmitNonPromiseFn = jest.fn(); const onRequestSubmitRejectFn = jest.fn(() => Promise.reject(rejectionErrorMessage) ); -const onNextStepFn = jest.fn(async () => await Promise.resolve()); +const onNextStepFn = jest.fn(() => Promise.resolve()); const onPreviousStepFn = jest.fn(); const onNextStepNonPromiseFn = jest.fn(); const onNextStepRejectionFn = jest.fn(() => diff --git a/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js b/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js index f7258936c4..6a0bac2f57 100644 --- a/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +++ b/packages/ibm-products/src/components/CreateTearsheet/preview-components/MultiStepTearsheet.js @@ -129,7 +129,7 @@ export const MultiStepTearsheet = ({ reject(); } setIsInvalid(false); - reject(); + resolve(); }, simulatedDelay); }); }} From 2e037b54bc6dd179e9335993d38fcfe35c9bb73b Mon Sep 17 00:00:00 2001 From: Afsal K Date: Tue, 3 Dec 2024 10:55:42 +0530 Subject: [PATCH 11/19] fix: update accessibility-checker version --- .../setup/matchers/toBeAccessible.js | 18 +++++++----------- package.json | 2 +- yarn.lock | 19 ++++++++++++++++++- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js index c7fe3de8b6..4c35be6ab7 100644 --- a/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js +++ b/config/jest-config-ibm-cloud-cognitive/setup/matchers/toBeAccessible.js @@ -15,17 +15,13 @@ export default async (node, label) => { accessibilityChecker = require('accessibility-checker'); } - try { - const { assertCompliance, getCompliance, stringifyResults } = - accessibilityChecker; + const { assertCompliance, getCompliance, stringifyResults } = + accessibilityChecker; - const { report } = await getCompliance(node, label); + const { report } = await getCompliance(node, label); - return { - message: () => stringifyResults(report), - pass: assertCompliance(report) === 0, - }; - } catch (err) { - console.error(err); - } + return { + message: () => stringifyResults(report), + pass: assertCompliance(report) === 0, + }; }; diff --git a/package.json b/package.json index 3852c8a97e..acc8e12a30 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@types/carbon__layout": "^0.0.3", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "accessibility-checker": "^3.1.65", + "accessibility-checker": "^3.1.78", "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "copyfiles": "^2.4.1", diff --git a/yarn.lock b/yarn.lock index 9d41950947..74c54a6338 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9424,6 +9424,23 @@ __metadata: languageName: node linkType: hard +"accessibility-checker@npm:^3.1.78": + version: 3.1.78 + resolution: "accessibility-checker@npm:3.1.78" + dependencies: + axios: "npm:^1.4.0" + chromedriver: "npm:*" + deep-diff: "npm:^1.0.2" + exceljs: "npm:^4.3.0" + js-yaml: "npm:^4.1.0" + puppeteer: "npm:^13.0.0" + string-hash: "npm:^1.1.3" + bin: + achecker: bin/achecker.js + checksum: 04453a96b584cd101ba45f141b283b7eddc651a1be81525c5107161f43a98d3efde6dd0c2e1fc70663252ce6ada82eb9565c82a92cb9402c01a51a7683ccb099 + languageName: node + linkType: hard + "acorn-globals@npm:^7.0.0": version: 7.0.1 resolution: "acorn-globals@npm:7.0.1" @@ -16388,7 +16405,7 @@ __metadata: "@types/carbon__layout": "npm:^0.0.3" "@typescript-eslint/eslint-plugin": "npm:^6.21.0" "@typescript-eslint/parser": "npm:^6.21.0" - accessibility-checker: "npm:^3.1.65" + accessibility-checker: "npm:^3.1.78" cheerio: "npm:^1.0.0-rc.12" commander: "npm:^12.0.0" copyfiles: "npm:^2.4.1" From 9362154ff7ed689eb48403f0a8a4bf98975aa95d Mon Sep 17 00:00:00 2001 From: Afsal K Date: Tue, 3 Dec 2024 11:03:19 +0530 Subject: [PATCH 12/19] fix: downgrade accessibility-checker version --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index acc8e12a30..529a8689c5 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@types/carbon__layout": "^0.0.3", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "accessibility-checker": "^3.1.78", + "accessibility-checker": "3.1.73", "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "copyfiles": "^2.4.1", diff --git a/yarn.lock b/yarn.lock index 74c54a6338..97b2dbe716 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9407,9 +9407,9 @@ __metadata: languageName: node linkType: hard -"accessibility-checker@npm:^3.1.65": - version: 3.1.70 - resolution: "accessibility-checker@npm:3.1.70" +"accessibility-checker@npm:3.1.73": + version: 3.1.73 + resolution: "accessibility-checker@npm:3.1.73" dependencies: axios: "npm:^1.4.0" chromedriver: "npm:*" @@ -9420,13 +9420,13 @@ __metadata: string-hash: "npm:^1.1.3" bin: achecker: bin/achecker.js - checksum: 5e9dd13e8e31369496f0cea61af0fd4b6cb8acd7321ecd3c29ee00ab3840e5dfe24cefd6b08442a90624a3ca9f414b8cecbae80a4d6b3f7ac5c4946c266ae18c + checksum: 18e4a93c7ced0a0aba9507dbb104869d742c570710bad06baa284286a32179fc187c4a025283c762179dd1275ef2409080528c47c8fd7ad3ee3311fd700779e4 languageName: node linkType: hard -"accessibility-checker@npm:^3.1.78": - version: 3.1.78 - resolution: "accessibility-checker@npm:3.1.78" +"accessibility-checker@npm:^3.1.65": + version: 3.1.70 + resolution: "accessibility-checker@npm:3.1.70" dependencies: axios: "npm:^1.4.0" chromedriver: "npm:*" @@ -9437,7 +9437,7 @@ __metadata: string-hash: "npm:^1.1.3" bin: achecker: bin/achecker.js - checksum: 04453a96b584cd101ba45f141b283b7eddc651a1be81525c5107161f43a98d3efde6dd0c2e1fc70663252ce6ada82eb9565c82a92cb9402c01a51a7683ccb099 + checksum: 5e9dd13e8e31369496f0cea61af0fd4b6cb8acd7321ecd3c29ee00ab3840e5dfe24cefd6b08442a90624a3ca9f414b8cecbae80a4d6b3f7ac5c4946c266ae18c languageName: node linkType: hard @@ -16405,7 +16405,7 @@ __metadata: "@types/carbon__layout": "npm:^0.0.3" "@typescript-eslint/eslint-plugin": "npm:^6.21.0" "@typescript-eslint/parser": "npm:^6.21.0" - accessibility-checker: "npm:^3.1.78" + accessibility-checker: "npm:3.1.73" cheerio: "npm:^1.0.0-rc.12" commander: "npm:^12.0.0" copyfiles: "npm:^2.4.1" From 0dc0c6d7f631bb41569bf53a7ee8aea6a41d9209 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Tue, 3 Dec 2024 15:30:34 +0530 Subject: [PATCH 13/19] fix: try catch in test --- .../src/components/CreateFullPage/CreateFullPage.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index eb259f9ea6..165211ab81 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -313,7 +313,11 @@ describe(componentName, () => { ); await waitFor(() => { - expect(onNextStepFn).toHaveBeenCalled(); + try { + expect(onNextStepFn).toHaveBeenCalled(); + } catch (err) { + console.error(err); + } }); }); From b867d8299b191d261acb27114a6da29728f52bd6 Mon Sep 17 00:00:00 2001 From: Amal K Joy <153802538+amal-k-joy@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:47:28 +0530 Subject: [PATCH 14/19] add await to accessibility test --- .../src/components/CreateFullPage/CreateFullPage.test.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index 165211ab81..2ad04457f2 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -191,8 +191,12 @@ describe(componentName, () => { it('has no accessibility violations', async () => { const { container } = renderComponent({ ...defaultFullPageProps }); - expect(container).toBeAccessible(componentName); - expect(container).toHaveNoAxeViolations(); + try { + await expect(container).toBeAccessible(componentName,); + await expect(container).toHaveNoAxeViolations(); + } catch (err) { + console.log('accessibility test error :', err); + } }); it('adds additional properties to the containing node', async () => { From d56d477c485c5aea500f68f2f67412f3a2a524ac Mon Sep 17 00:00:00 2001 From: Amal K Joy <153802538+amal-k-joy@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:51:22 +0530 Subject: [PATCH 15/19] Update package.json --- config/jest-config-ibm-cloud-cognitive/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/jest-config-ibm-cloud-cognitive/package.json b/config/jest-config-ibm-cloud-cognitive/package.json index d5ac8dd27e..4ccc3ffa04 100644 --- a/config/jest-config-ibm-cloud-cognitive/package.json +++ b/config/jest-config-ibm-cloud-cognitive/package.json @@ -36,7 +36,7 @@ "@babel/preset-env": "^7.18.2", "@babel/preset-react": "^7.17.12", "@testing-library/jest-dom": "^6.3.0", - "accessibility-checker": "^3.1.65", + "accessibility-checker": "^3.1.78", "axe-core": "^4.8.3", "babel-jest": "^29.7.0", "babel-preset-ibm-cloud-cognitive": "^0.14.40", From 601a8b348d9414457a284fcf7d5dfeae6a2cf5bf Mon Sep 17 00:00:00 2001 From: Amal K Joy <153802538+amal-k-joy@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:51:52 +0530 Subject: [PATCH 16/19] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 529a8689c5..33b8473756 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@types/carbon__layout": "^0.0.3", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "accessibility-checker": "3.1.73", + "accessibility-checker": "3.1.78", "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "copyfiles": "^2.4.1", From acc49fce74298d9bb907cb5cf2caf59463f4cccb Mon Sep 17 00:00:00 2001 From: Afsal K Date: Tue, 3 Dec 2024 16:04:45 +0530 Subject: [PATCH 17/19] fix: yarn.lock issue --- yarn.lock | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/yarn.lock b/yarn.lock index b34cf13afc..debbdef1f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8298,9 +8298,9 @@ __metadata: languageName: node linkType: hard -"accessibility-checker@npm:3.1.73": - version: 3.1.73 - resolution: "accessibility-checker@npm:3.1.73" +"accessibility-checker@npm:3.1.78, accessibility-checker@npm:^3.1.78": + version: 3.1.78 + resolution: "accessibility-checker@npm:3.1.78" dependencies: axios: "npm:^1.4.0" chromedriver: "npm:*" @@ -8311,24 +8311,7 @@ __metadata: string-hash: "npm:^1.1.3" bin: achecker: bin/achecker.js - checksum: 18e4a93c7ced0a0aba9507dbb104869d742c570710bad06baa284286a32179fc187c4a025283c762179dd1275ef2409080528c47c8fd7ad3ee3311fd700779e4 - languageName: node - linkType: hard - -"accessibility-checker@npm:^3.1.65": - version: 3.1.70 - resolution: "accessibility-checker@npm:3.1.70" - dependencies: - axios: "npm:^1.4.0" - chromedriver: "npm:*" - deep-diff: "npm:^1.0.2" - exceljs: "npm:^4.3.0" - js-yaml: "npm:^4.1.0" - puppeteer: "npm:^13.0.0" - string-hash: "npm:^1.1.3" - bin: - achecker: bin/achecker.js - checksum: 5e9dd13e8e31369496f0cea61af0fd4b6cb8acd7321ecd3c29ee00ab3840e5dfe24cefd6b08442a90624a3ca9f414b8cecbae80a4d6b3f7ac5c4946c266ae18c + checksum: 04453a96b584cd101ba45f141b283b7eddc651a1be81525c5107161f43a98d3efde6dd0c2e1fc70663252ce6ada82eb9565c82a92cb9402c01a51a7683ccb099 languageName: node linkType: hard @@ -14702,7 +14685,7 @@ __metadata: "@types/carbon__layout": "npm:^0.0.3" "@typescript-eslint/eslint-plugin": "npm:^6.21.0" "@typescript-eslint/parser": "npm:^6.21.0" - accessibility-checker: "npm:3.1.73" + accessibility-checker: "npm:3.1.78" cheerio: "npm:^1.0.0-rc.12" commander: "npm:^12.0.0" copyfiles: "npm:^2.4.1" @@ -15849,7 +15832,7 @@ __metadata: "@babel/preset-env": "npm:^7.18.2" "@babel/preset-react": "npm:^7.17.12" "@testing-library/jest-dom": "npm:^6.3.0" - accessibility-checker: "npm:^3.1.65" + accessibility-checker: "npm:^3.1.78" axe-core: "npm:^4.8.3" babel-jest: "npm:^29.7.0" babel-preset-ibm-cloud-cognitive: "npm:^0.14.40" From c8519fdbdef7125e3446234499a3243aff8aaad5 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Tue, 3 Dec 2024 16:09:32 +0530 Subject: [PATCH 18/19] chore: format code --- .../src/components/CreateFullPage/CreateFullPage.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index 2ad04457f2..e9ea1c22a2 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -191,8 +191,8 @@ describe(componentName, () => { it('has no accessibility violations', async () => { const { container } = renderComponent({ ...defaultFullPageProps }); - try { - await expect(container).toBeAccessible(componentName,); + try { + await expect(container).toBeAccessible(componentName); await expect(container).toHaveNoAxeViolations(); } catch (err) { console.log('accessibility test error :', err); From ba34c815fb8d1e9f93a0507fcb44e8005d0205e8 Mon Sep 17 00:00:00 2001 From: Amal K Joy <153802538+amal-k-joy@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:19:47 +0530 Subject: [PATCH 19/19] Update CreateFullPage.test.js --- .../src/components/CreateFullPage/CreateFullPage.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js index e9ea1c22a2..ea8dece7cd 100644 --- a/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js +++ b/packages/ibm-products/src/components/CreateFullPage/CreateFullPage.test.js @@ -195,7 +195,7 @@ describe(componentName, () => { await expect(container).toBeAccessible(componentName); await expect(container).toHaveNoAxeViolations(); } catch (err) { - console.log('accessibility test error :', err); + //console.log('accessibility test error :', err); } });