From b4215560d4e8ee1ff5460ded81dc3410ba1c25d2 Mon Sep 17 00:00:00 2001 From: nicolethoen Date: Mon, 3 Jul 2023 13:59:31 -0400 Subject: [PATCH 1/4] chore(a11y): clean up a11y config so we test valid URLs and limit timeouts --- packages/react-docs/patternfly-a11y.config.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/patternfly-a11y.config.js b/packages/react-docs/patternfly-a11y.config.js index baff9267ad1..6cdb386c690 100644 --- a/packages/react-docs/patternfly-a11y.config.js +++ b/packages/react-docs/patternfly-a11y.config.js @@ -14,10 +14,26 @@ const urls = Object.keys(fullscreenRoutes) if (fullscreenRoutes[key].isFullscreenOnly) { return key; } else { + // the default tab for each component/pattern does not have a trailing 'react-demo' or 'react' string in the url + // so we strip the trailing string from those paths. const path = fullscreenRoutes[key].path; - if (path.match(/\/demos\/.*\/react-demos$/g)) { + if (path.match(/\/patterns\/.*\/react-demos$/g)) { + console.log(path); return path.replace(/\/react-demos$/, ''); } else { + // some demos have been moved to the component section, so their default tab has a trailing 'react-demos' + if (path.match(/\/components\/.*\/react-demos$/g)){ + if (path.includes('application-launcher') | + path.includes('context-selector') | + path.includes('date-and-time-picker') | + path.includes('password-generator') | + path.includes('password-strength') | + path.includes('custom-menus') | + path.includes('options-menu')) { + return path.replace(/\/react-demos$/, ''); + } + } + // all other pages in the components section have a trailing 'react' string in their default tab return path.replace(/\/react$/, ''); } } From 7f6c168311762db3dc83dfdf759a20b35c076fd8 Mon Sep 17 00:00:00 2001 From: nicolethoen Date: Wed, 5 Jul 2023 09:41:52 -0400 Subject: [PATCH 2/4] tighten logic a little more --- packages/react-docs/patternfly-a11y.config.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/react-docs/patternfly-a11y.config.js b/packages/react-docs/patternfly-a11y.config.js index 6cdb386c690..d8fcfb85122 100644 --- a/packages/react-docs/patternfly-a11y.config.js +++ b/packages/react-docs/patternfly-a11y.config.js @@ -23,13 +23,13 @@ const urls = Object.keys(fullscreenRoutes) } else { // some demos have been moved to the component section, so their default tab has a trailing 'react-demos' if (path.match(/\/components\/.*\/react-demos$/g)){ - if (path.includes('application-launcher') | - path.includes('context-selector') | - path.includes('date-and-time-picker') | - path.includes('password-generator') | - path.includes('password-strength') | - path.includes('custom-menus') | - path.includes('options-menu')) { + if (path.includes('/application-launcher/') | + path.includes('/context-selector/') | + path.includes('/date-and-time-picker/') | + path.includes('/password-generator/') | + path.includes('/password-strength/') | + path.includes('/custom-menus/') | + path.includes('/options-menu/')) { return path.replace(/\/react-demos$/, ''); } } From bbbe5def4aeece7fea544c7533a68686de5e6543 Mon Sep 17 00:00:00 2001 From: nicolethoen Date: Mon, 17 Jul 2023 08:28:06 -0400 Subject: [PATCH 3/4] remove console statement --- packages/react-docs/patternfly-a11y.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-docs/patternfly-a11y.config.js b/packages/react-docs/patternfly-a11y.config.js index d8fcfb85122..c56b6583dc0 100644 --- a/packages/react-docs/patternfly-a11y.config.js +++ b/packages/react-docs/patternfly-a11y.config.js @@ -18,7 +18,6 @@ const urls = Object.keys(fullscreenRoutes) // so we strip the trailing string from those paths. const path = fullscreenRoutes[key].path; if (path.match(/\/patterns\/.*\/react-demos$/g)) { - console.log(path); return path.replace(/\/react-demos$/, ''); } else { // some demos have been moved to the component section, so their default tab has a trailing 'react-demos' From bf6c5796c89683c87eba76fb835349baf968f709 Mon Sep 17 00:00:00 2001 From: nicolethoen Date: Wed, 9 Aug 2023 09:14:02 -0400 Subject: [PATCH 4/4] use logical OR rather than bitwise --- packages/react-docs/patternfly-a11y.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-docs/patternfly-a11y.config.js b/packages/react-docs/patternfly-a11y.config.js index c56b6583dc0..546868e2a46 100644 --- a/packages/react-docs/patternfly-a11y.config.js +++ b/packages/react-docs/patternfly-a11y.config.js @@ -22,12 +22,12 @@ const urls = Object.keys(fullscreenRoutes) } else { // some demos have been moved to the component section, so their default tab has a trailing 'react-demos' if (path.match(/\/components\/.*\/react-demos$/g)){ - if (path.includes('/application-launcher/') | - path.includes('/context-selector/') | - path.includes('/date-and-time-picker/') | - path.includes('/password-generator/') | - path.includes('/password-strength/') | - path.includes('/custom-menus/') | + if (path.includes('/application-launcher/') || + path.includes('/context-selector/') || + path.includes('/date-and-time-picker/') || + path.includes('/password-generator/') || + path.includes('/password-strength/') || + path.includes('/custom-menus/') || path.includes('/options-menu/')) { return path.replace(/\/react-demos$/, ''); }