From 6c7c0696be6680778312398629af8008b1584efa Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Mon, 28 Sep 2026 11:00:45 -0400 Subject: [PATCH 01/10] feat(Page,Compass,Nav,MenuToggle,Button): simplify docked nav expand props --- packages/react-core/package.json | 2 +- .../src/components/Button/Button.tsx | 3 +- .../src/components/Compass/Compass.tsx | 16 ++--- .../src/components/MenuToggle/MenuToggle.tsx | 5 -- .../react-core/src/components/Nav/Nav.tsx | 6 +- .../react-core/src/components/Page/Page.tsx | 17 ++---- .../Compass/examples/CompassDockDemo.tsx | 59 +++++++------------ .../src/demos/examples/Nav/NavDockedNav.tsx | 59 +++++++------------ packages/react-docs/package.json | 2 +- packages/react-icons/package.json | 2 +- packages/react-styles/package.json | 2 +- packages/react-tokens/package.json | 4 +- .../react-tokens/scripts/generateTokens.mjs | 2 +- yarn.lock | 28 ++++----- 14 files changed, 79 insertions(+), 128 deletions(-) diff --git a/packages/react-core/package.json b/packages/react-core/package.json index 7593821872c..5dad1562844 100644 --- a/packages/react-core/package.json +++ b/packages/react-core/package.json @@ -54,7 +54,7 @@ "tslib": "^2.8.1" }, "devDependencies": { - "@patternfly/patternfly": "6.6.0-prerelease.49", + "@patternfly/patternfly": "6.6.0-prerelease.50", "case-anything": "^3.1.2", "css": "^3.0.0", "fs-extra": "^11.3.3" diff --git a/packages/react-core/src/components/Button/Button.tsx b/packages/react-core/src/components/Button/Button.tsx index 46d903f15a0..6912c165230 100644 --- a/packages/react-core/src/components/Button/Button.tsx +++ b/packages/react-core/src/components/Button/Button.tsx @@ -139,7 +139,6 @@ const ButtonBase: React.FunctionComponent = ({ hamburgerVariant, isCircle, isDocked = false, - isTextExpanded = false, spinnerAriaValueText, spinnerAriaLabelledBy, spinnerAriaLabel, @@ -272,7 +271,7 @@ const ButtonBase: React.FunctionComponent = ({ size === ButtonSize.lg && styles.modifiers.displayLg, isCircle && styles.modifiers.circle, isDocked && styles.modifiers.docked, - isDocked && isTextExpanded && styles.modifiers.textExpanded, + isDocked && isExpanded && styles.modifiers.expanded, className )} disabled={isButtonElement ? isDisabled : null} diff --git a/packages/react-core/src/components/Compass/Compass.tsx b/packages/react-core/src/components/Compass/Compass.tsx index d62bef6448c..7b75bcadcd1 100644 --- a/packages/react-core/src/components/Compass/Compass.tsx +++ b/packages/react-core/src/components/Compass/Compass.tsx @@ -10,14 +10,10 @@ export interface CompassProps extends React.HTMLProps { masthead?: React.ReactNode; /** Content of the docked navigation area of the layout */ dock?: React.ReactNode; - /** @beta Flag indicating the docked nav is expanded on mobile. Only applies when dock content is passed. */ + /** @beta Flag indicating the docked nav is expanded. Only applies when dock content is passed. */ isDockExpanded?: boolean; - /** @beta Flag indicating a docked nav is expanded as an overlay, triggered by expandable nav children. Only applies when dock content is passed. */ - isDockExpandableExpanded?: boolean; - /** @beta Flag indicating the docked nav should display text on desktop. Only applies when dock content is passed, and - * will handle toggling the visibility of the text in individual isDocked components. - */ - isDockTextExpanded?: boolean; + /** @beta Indicates if the docked nav should expand as an overlay instead of the default inline. */ + isDockOverlay?: boolean; /** Content placed at the top of the compass layout */ header?: React.ReactNode; /** Flag indicating if the header is expanded */ @@ -47,8 +43,7 @@ export const Compass: React.FunctionComponent = ({ masthead, dock, isDockExpanded, - isDockExpandableExpanded, - isDockTextExpanded, + isDockOverlay, header, isHeaderExpanded = true, sidebarStart, @@ -72,8 +67,7 @@ export const Compass: React.FunctionComponent = ({ className={css( `${styles.compass}__dock`, isDockExpanded && styles.modifiers.expanded, - isDockExpandableExpanded && styles.modifiers.expandableExpanded, - isDockTextExpanded && styles.modifiers.textExpanded + isDockOverlay && styles.modifiers.overlay )} > {dock} diff --git a/packages/react-core/src/components/MenuToggle/MenuToggle.tsx b/packages/react-core/src/components/MenuToggle/MenuToggle.tsx index aa5f8d6ba12..73646fd7df8 100644 --- a/packages/react-core/src/components/MenuToggle/MenuToggle.tsx +++ b/packages/react-core/src/components/MenuToggle/MenuToggle.tsx @@ -55,8 +55,6 @@ export interface MenuToggleProps isSettings?: boolean; /** @beta Flag indicating the menu toggle is a docked variant. For use in docked navigation. */ isDocked?: boolean; - /** @beta Flag indicating the docked toggle should display text. Only applies when isDocked is true. */ - isTextExpanded?: boolean; /** Elements to display before the toggle button. When included, renders the menu toggle as a split button. */ splitButtonItems?: React.ReactNode[]; /** Variant styles of the menu toggle */ @@ -95,7 +93,6 @@ class MenuToggleBase extends Component { isPlaceholder: false, isCircle: false, isDocked: false, - isTextExpanded: false, size: 'default', ouiaSafe: true, 'aria-haspopup': 'menu' @@ -116,7 +113,6 @@ class MenuToggleBase extends Component { isCircle, isSettings, isDocked, - isTextExpanded, splitButtonItems, variant, status, @@ -204,7 +200,6 @@ class MenuToggleBase extends Component { isPlaceholder && styles.modifiers.placeholder, isSettings && styles.modifiers.settings, isDocked && styles.modifiers.docked, - isDocked && isTextExpanded && styles.modifiers.textExpanded, size === MenuToggleSize.sm && styles.modifiers.small, className ); diff --git a/packages/react-core/src/components/Nav/Nav.tsx b/packages/react-core/src/components/Nav/Nav.tsx index baf646a69ad..7c126720e71 100644 --- a/packages/react-core/src/components/Nav/Nav.tsx +++ b/packages/react-core/src/components/Nav/Nav.tsx @@ -40,7 +40,7 @@ export interface NavProps /** The nav variant to use. Docked is in beta. */ variant?: 'default' | 'horizontal' | 'horizontal-subnav' | 'docked'; /** @beta Flag indicating the docked nav should display text. Only applies when variant is docked. */ - isTextExpanded?: boolean; + isExpanded?: boolean; /** Value to overwrite the randomly generated data-ouia-component-id.*/ ouiaId?: number | string; /** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ @@ -121,7 +121,7 @@ class Nav extends Component { className?: string; /** @beta Indicates the layout variant */ variant?: 'default' | 'docked'; - /** @beta Flag indicating the docked nav is expanded on mobile. Only applies when variant is docked. */ + /** @beta Flag indicating the docked nav is expanded. Only applies when variant is docked. */ isDockExpanded?: boolean; - /** @beta Flag indicating a docked nav is expanded as an overlay, triggered by expandable nav children. Only applies when dock content is passed. */ - isDockExpandableExpanded?: boolean; - /** @beta Flag indicating the docked nav should display text on desktop. Only applies when variant is docked, and - * will handle toggling the visibility of the text in individual isDocked components. - */ - isDockTextExpanded?: boolean; + /** @beta Indicates if the docked nav should expand as an overlay instead of the default inline. */ + isDockOverlay?: boolean; /** The horizontal masthead content (e.g. or ). PageHeader is an alternative to Masthead * and should only be used to wrap custom header content. When using the docked variant, this content will only render at * mobile viewports. @@ -140,7 +136,6 @@ class Page extends Component { defaultManagedSidebarIsOpen: true, mainTabIndex: -1, isNotificationDrawerExpanded: false, - isDockExpandableExpanded: false, onNotificationDrawerExpand: () => null, mainComponent: 'main', getBreakpoint, @@ -255,8 +250,7 @@ class Page extends Component { children, variant, isDockExpanded = false, - isDockTextExpanded = false, - isDockExpandableExpanded = false, + isDockOverlay = false, masthead, dockContent, sidebar, @@ -386,8 +380,7 @@ class Page extends Component { className={css( styles.pageDock, isDockExpanded && styles.modifiers.expanded, - isDockExpandableExpanded && styles.modifiers.expandableExpanded, - isDockTextExpanded && styles.modifiers.textExpanded + isDockOverlay && styles.modifiers.overlay )} >
{dockContent}
diff --git a/packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx b/packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx index 7339582b058..2a8f0fe1c63 100644 --- a/packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx +++ b/packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx @@ -51,8 +51,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { const [activeItem, setActiveItem] = useState(0); const [isNavGroupExpanded, setIsNavGroupExpanded] = useState(false); const [isDockExpanded, setIsDockExpanded] = useState(false); - const [isDockTextExpanded, setIsDockTextExpanded] = useState(false); - const [isDockExpandableExpanded, setIsDockExpandableExpanded] = useState(false); + const [isDockOverlay, setIsDockOverlay] = useState(false); const [isMobile, setIsMobile] = useState(false); useEffect(() => { @@ -69,7 +68,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { }, []); const handleDockClickOutside = (event: MouseEvent) => { - if ((!isMobile && !isDockExpandableExpanded) || (isMobile && !isDockExpanded)) { + if (!isDockExpanded) { return; } @@ -80,21 +79,21 @@ export const CompassDockDemo: React.FunctionComponent = () => { dockedMastheadElement && !dockedMastheadElement.contains(event.target as Node) && !dockedMobileMastheadToggle?.contains(event.target as Node) && - (isDockExpandableExpanded || isDockExpanded) + isDockExpanded ) { - setIsDockExpandableExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); } }; const handleDockKeydown = (_event: KeyboardEvent) => { - if ((!isMobile && !isDockExpandableExpanded) || (isMobile && !isDockExpanded)) { + if (!isDockExpanded) { return; } if (_event.key === 'Escape') { - setIsDockExpandableExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); } }; @@ -106,18 +105,17 @@ export const CompassDockDemo: React.FunctionComponent = () => { window.removeEventListener('click', handleDockClickOutside); window.removeEventListener('keydown', handleDockKeydown); }; - }, [isDockExpandableExpanded, isDockTextExpanded, isDockExpanded, isMobile]); + }, [isDockOverlay, isDockExpanded, isMobile]); const onNavSelect = (_event: React.FormEvent, selectedItem: NavOnSelectProps) => { typeof selectedItem.itemId === 'number' && setActiveItem(selectedItem.itemId); - if (!isMobile && isDockTextExpanded) { + if (isDockExpanded && !isDockOverlay) { return; } - setIsDockExpandableExpanded(false); - setIsDockTextExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); }; const navItem1Ref = useRef(null); @@ -141,43 +139,31 @@ export const CompassDockDemo: React.FunctionComponent = () => { }; const onToggleDock = () => { - if (isMobile) { - setIsDockExpanded(!isDockExpanded); + setIsDockExpanded(!isDockExpanded); + if (isMobile) { if (isDockExpanded) { setTimeout(() => { mobileToggleRef.current?.focus(); }, 200); } - } else { - const nextDockTextExpanded = !isDockTextExpanded; - setIsDockTextExpanded(nextDockTextExpanded); - - if (!nextDockTextExpanded) { - setIsDockExpandableExpanded(false); - } - - if (isDockExpandableExpanded) { - setIsDockExpandableExpanded(false); - setIsDockTextExpanded(false); - } } }; const onToggleNavGroup = (_event: React.MouseEvent, isExpanded: boolean) => { - if (!isDockExpandableExpanded && !isDockTextExpanded && !isDockExpanded) { + if (!isDockExpanded) { setIsNavGroupExpanded(true); } else { setIsNavGroupExpanded(isExpanded); } if (!isMobile) { - if (!isDockExpandableExpanded && !isDockTextExpanded) { - setIsDockExpandableExpanded(true); + if (!isDockOverlay) { + setIsDockOverlay(true); } - if (!isDockTextExpanded) { - setIsDockTextExpanded(false); + if (!isDockExpanded) { + setIsDockExpanded(true); } } }; @@ -315,7 +301,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { isHamburger onClick={onToggleDock} aria-label="Global navigation" - isExpanded={isDockTextExpanded} + isExpanded={isDockExpanded} /> @@ -409,7 +395,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { - {!isDockTextExpanded && !isDockExpanded && !isDockExpandableExpanded && ( + {!isDockExpanded && ( <> @@ -426,7 +412,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { gap={{ default: 'gapNone', md: 'gapMd' }} > - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( { )} - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( @@ -464,7 +450,7 @@ export const CompassDockDemo: React.FunctionComponent = () => { )} - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( { masthead={mobileMasthead} dock={dockContent} isDockExpanded={isDockExpanded} - isDockExpandableExpanded={isDockExpandableExpanded} - isDockTextExpanded={isDockTextExpanded} + isDockOverlay={isDockOverlay} main={mainContent} backgroundSrcDark="/assets/images/pf-background.svg" backgroundSrcLight="/assets/images/pf-background.svg" diff --git a/packages/react-core/src/demos/examples/Nav/NavDockedNav.tsx b/packages/react-core/src/demos/examples/Nav/NavDockedNav.tsx index 40f73573023..685dd359222 100644 --- a/packages/react-core/src/demos/examples/Nav/NavDockedNav.tsx +++ b/packages/react-core/src/demos/examples/Nav/NavDockedNav.tsx @@ -54,8 +54,7 @@ export const NavDockedNav: React.FunctionComponent = () => { const [activeItem, setActiveItem] = useState(1); const [isNavGroupExpanded, setIsNavGroupExpanded] = useState(false); const [isDockExpanded, setIsDockExpanded] = useState(false); - const [isDockTextExpanded, setIsDockTextExpanded] = useState(false); - const [isDockExpandableExpanded, setIsDockExpandableExpanded] = useState(false); + const [isDockOverlay, setIsDockOverlay] = useState(false); const [isMobile, setIsMobile] = useState(false); useEffect(() => { @@ -72,7 +71,7 @@ export const NavDockedNav: React.FunctionComponent = () => { }, []); const handleDockClickOutside = (event: MouseEvent) => { - if ((!isMobile && !isDockExpandableExpanded) || (isMobile && !isDockExpanded)) { + if (!isDockExpanded) { return; } @@ -83,21 +82,21 @@ export const NavDockedNav: React.FunctionComponent = () => { dockedMastheadElement && !dockedMastheadElement.contains(event.target as Node) && !dockedMobileMastheadToggle?.contains(event.target as Node) && - (isDockExpandableExpanded || isDockExpanded) + isDockExpanded ) { - setIsDockExpandableExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); } }; const handleDockKeydown = (_event: KeyboardEvent) => { - if ((!isMobile && !isDockExpandableExpanded) || (isMobile && !isDockExpanded)) { + if (!isDockExpanded) { return; } if (_event.key === 'Escape') { - setIsDockExpandableExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); } }; @@ -109,18 +108,17 @@ export const NavDockedNav: React.FunctionComponent = () => { window.removeEventListener('click', handleDockClickOutside); window.removeEventListener('keydown', handleDockKeydown); }; - }, [isDockExpandableExpanded, isDockTextExpanded, isDockExpanded, isMobile]); + }, [isDockOverlay, isDockExpanded, isMobile]); const onNavSelect = (_event: React.FormEvent, selectedItem: NavOnSelectProps) => { typeof selectedItem.itemId === 'number' && setActiveItem(selectedItem.itemId); - if (!isMobile && isDockTextExpanded) { + if (isDockExpanded && !isDockOverlay) { return; } - setIsDockExpandableExpanded(false); - setIsDockTextExpanded(false); setIsDockExpanded(false); + setIsDockOverlay(false); }; const mobileTextLogo = ( @@ -251,43 +249,31 @@ export const NavDockedNav: React.FunctionComponent = () => { }; const onToggleDock = () => { - if (isMobile) { - setIsDockExpanded(!isDockExpanded); + setIsDockExpanded(!isDockExpanded); + if (isMobile) { if (isDockExpanded) { setTimeout(() => { mobileToggleRef.current?.focus(); }, 200); } - } else { - const nextDockTextExpanded = !isDockTextExpanded; - setIsDockTextExpanded(nextDockTextExpanded); - - if (!nextDockTextExpanded) { - setIsDockExpandableExpanded(false); - } - - if (isDockExpandableExpanded) { - setIsDockExpandableExpanded(false); - setIsDockTextExpanded(false); - } } }; const onToggleNavGroup = (_event: React.MouseEvent, isExpanded: boolean) => { - if (!isDockExpandableExpanded && !isDockTextExpanded && !isDockExpanded) { + if (!isDockExpanded) { setIsNavGroupExpanded(true); } else { setIsNavGroupExpanded(isExpanded); } if (!isMobile) { - if (!isDockExpandableExpanded && !isDockTextExpanded) { - setIsDockExpandableExpanded(true); + if (!isDockOverlay) { + setIsDockOverlay(true); } - if (!isDockTextExpanded) { - setIsDockTextExpanded(false); + if (!isDockExpanded) { + setIsDockExpanded(true); } } }; @@ -339,7 +325,7 @@ export const NavDockedNav: React.FunctionComponent = () => { isHamburger onClick={onToggleDock} aria-label="Global navigation" - isExpanded={isDockTextExpanded} + isExpanded={isDockExpanded} /> @@ -429,7 +415,7 @@ export const NavDockedNav: React.FunctionComponent = () => { - {!isDockTextExpanded && !isDockExpanded && !isDockExpandableExpanded && ( + {!isDockExpanded && ( <> @@ -446,7 +432,7 @@ export const NavDockedNav: React.FunctionComponent = () => { gap={{ default: 'gapNone', md: 'gapMd' }} > - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( { )} - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( @@ -484,7 +470,7 @@ export const NavDockedNav: React.FunctionComponent = () => { )} - {isDockTextExpanded || isDockExpanded ? ( + {isDockExpanded ? ( { Date: Mon, 28 Sep 2026 11:12:51 -0400 Subject: [PATCH 02/10] wording --- packages/react-core/src/components/Compass/Compass.tsx | 2 +- packages/react-core/src/components/Page/Page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-core/src/components/Compass/Compass.tsx b/packages/react-core/src/components/Compass/Compass.tsx index 7b75bcadcd1..1b193849e99 100644 --- a/packages/react-core/src/components/Compass/Compass.tsx +++ b/packages/react-core/src/components/Compass/Compass.tsx @@ -12,7 +12,7 @@ export interface CompassProps extends React.HTMLProps { dock?: React.ReactNode; /** @beta Flag indicating the docked nav is expanded. Only applies when dock content is passed. */ isDockExpanded?: boolean; - /** @beta Indicates if the docked nav should expand as an overlay instead of the default inline. */ + /** @beta Flag indicating the docked nav should expand as an overlay instead of the default inline. */ isDockOverlay?: boolean; /** Content placed at the top of the compass layout */ header?: React.ReactNode; diff --git a/packages/react-core/src/components/Page/Page.tsx b/packages/react-core/src/components/Page/Page.tsx index b546d510e25..29eb1644d8d 100644 --- a/packages/react-core/src/components/Page/Page.tsx +++ b/packages/react-core/src/components/Page/Page.tsx @@ -24,7 +24,7 @@ export interface PageProps extends React.HTMLProps { variant?: 'default' | 'docked'; /** @beta Flag indicating the docked nav is expanded. Only applies when variant is docked. */ isDockExpanded?: boolean; - /** @beta Indicates if the docked nav should expand as an overlay instead of the default inline. */ + /** @beta Flag indicating the docked nav should expand as an overlay instead of the default inline. */ isDockOverlay?: boolean; /** The horizontal masthead content (e.g. or ). PageHeader is an alternative to Masthead * and should only be used to wrap custom header content. When using the docked variant, this content will only render at From d4173eb783b6714444fbe73460f48f24b7a6ec4a Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Mon, 28 Sep 2026 15:23:57 -0400 Subject: [PATCH 03/10] update tests for props --- .../Button/__tests__/Button.test.tsx | 22 ++++++------ .../Compass/__tests__/Compass.test.tsx | 26 ++------------ .../MenuToggle/__tests__/MenuToggle.test.tsx | 27 +++++---------- .../src/components/Nav/__tests__/Nav.test.tsx | 16 ++++----- .../components/Page/__tests__/Page.test.tsx | 34 +++---------------- 5 files changed, 34 insertions(+), 91 deletions(-) diff --git a/packages/react-core/src/components/Button/__tests__/Button.test.tsx b/packages/react-core/src/components/Button/__tests__/Button.test.tsx index 94c3f8bf5f8..c714b8fedd2 100644 --- a/packages/react-core/src/components/Button/__tests__/Button.test.tsx +++ b/packages/react-core/src/components/Button/__tests__/Button.test.tsx @@ -566,34 +566,34 @@ describe('Dock variant', () => { expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.docked); }); - test(`Renders with class ${styles.modifiers.textExpanded} when isTextExpanded = true and isDocked = true`, () => { + test(`Renders with class ${styles.modifiers.expanded} when isExpanded = true and isDocked = true`, () => { render( - ); - expect(screen.getByRole('button')).toHaveClass(styles.modifiers.textExpanded); + expect(screen.getByRole('button')).toHaveClass(styles.modifiers.expanded); }); - test(`Does not render with class ${styles.modifiers.textExpanded} when isTextExpanded is not passed`, () => { + test(`Does not render with class ${styles.modifiers.expanded} when isExpanded is not passed`, () => { render(); - expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded); + expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.expanded); }); - test(`Does not render with class ${styles.modifiers.textExpanded} when isTextExpanded = true but isDocked is not passed`, () => { - render(); - expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded); + test(`Does not render with class ${styles.modifiers.expanded} when isExpanded = true but isDocked is not passed`, () => { + render(); + expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.expanded); }); - test(`Renders with both ${styles.modifiers.docked} and ${styles.modifiers.textExpanded} when both props are true`, () => { + test(`Renders with both ${styles.modifiers.docked} and ${styles.modifiers.expanded} when both props are true`, () => { render( - ); const button = screen.getByRole('button'); expect(button).toHaveClass(styles.modifiers.docked); - expect(button).toHaveClass(styles.modifiers.textExpanded); + expect(button).toHaveClass(styles.modifiers.expanded); }); }); diff --git a/packages/react-core/src/components/Compass/__tests__/Compass.test.tsx b/packages/react-core/src/components/Compass/__tests__/Compass.test.tsx index 5714a680108..fc0f8ce8987 100644 --- a/packages/react-core/src/components/Compass/__tests__/Compass.test.tsx +++ b/packages/react-core/src/components/Compass/__tests__/Compass.test.tsx @@ -94,19 +94,9 @@ test('Renders footer without expanded class and with inert when isFooterExpanded expect(footerElement).toHaveAttribute('inert'); }); -test(`Renders with ${styles.modifiers.expandableExpanded} class when isDockExpandableExpanded is true`, () => { - render(Dock content} isDockExpandableExpanded />); - expect(screen.getByText('Dock content').parentElement).toHaveClass(styles.modifiers.expandableExpanded); -}); - -test(`Does not render with ${styles.modifiers.expandableExpanded} class when isDockExpandableExpanded is false`, () => { - render(Dock content} isDockExpandableExpanded={false} />); - expect(screen.getByText('Dock content').parentElement).not.toHaveClass(styles.modifiers.expandableExpanded); -}); - -test(`Does not render with ${styles.modifiers.expandableExpanded} class by default`, () => { - render(Dock content} />); - expect(screen.getByText('Dock content').parentElement).not.toHaveClass(styles.modifiers.expandableExpanded); +test(`Renders with ${styles.modifiers.overlay} class when isDockOverlay is true`, () => { + render(Dock content} isDockOverlay />); + expect(screen.getByText('Dock content').parentElement).toHaveClass(styles.modifiers.overlay); }); test('Renders with drawer when drawerContent is provided', () => { @@ -194,13 +184,3 @@ test(`Renders dock without ${styles.modifiers.expanded} class when isDockExpande render(); expect(screen.getByText('Dock content')).not.toHaveClass(styles.modifiers.expanded); }); - -test(`Renders dock with ${styles.modifiers.textExpanded} class when isDockTextExpanded is true`, () => { - render(); - expect(screen.getByText('Dock content')).toHaveClass(styles.modifiers.textExpanded); -}); - -test(`Renders dock without ${styles.modifiers.textExpanded} class when isDockTextExpanded is false`, () => { - render(); - expect(screen.getByText('Dock content')).not.toHaveClass(styles.modifiers.textExpanded); -}); diff --git a/packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx b/packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx index d5df7c657c4..fcc73760821 100644 --- a/packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +++ b/packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx @@ -166,32 +166,21 @@ test(`Does not render with class ${styles.modifiers.docked} when isDocked is not expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.docked); }); -test(`Renders with class ${styles.modifiers.textExpanded} when isTextExpanded is passed and isDocked is passed`, () => { +test(`Renders with class ${styles.modifiers.expanded} when isExpanded is passed and isDocked is passed`, () => { render( - + Text Expanded Toggle ); - expect(screen.getByRole('button')).toHaveClass(styles.modifiers.textExpanded); + expect(screen.getByRole('button')).toHaveClass(styles.modifiers.expanded); }); -test(`Does not render with class ${styles.modifiers.textExpanded} when isTextExpanded is not passed`, () => { +test(`Does not render with class ${styles.modifiers.expanded} when isExpanded is not passed`, () => { render(Toggle); - expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded); + expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.expanded); }); -test(`Does not render with class ${styles.modifiers.textExpanded} when isTextExpanded is passed but isDocked is not passed`, () => { - render(Text Expanded Toggle); - expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded); -}); - -test(`Renders with both ${styles.modifiers.docked} and ${styles.modifiers.textExpanded} when both props are passed`, () => { - render( - - Dock Text Expanded Toggle - - ); - const button = screen.getByRole('button'); - expect(button).toHaveClass(styles.modifiers.docked); - expect(button).toHaveClass(styles.modifiers.textExpanded); +test(`Does not render with class ${styles.modifiers.expanded} when isExpanded is passed but isDocked is not passed`, () => { + render(Text Expanded Toggle); + expect(screen.getByRole('button')).toHaveClass(styles.modifiers.expanded); }); diff --git a/packages/react-core/src/components/Nav/__tests__/Nav.test.tsx b/packages/react-core/src/components/Nav/__tests__/Nav.test.tsx index 401b3657d3b..f5648418690 100644 --- a/packages/react-core/src/components/Nav/__tests__/Nav.test.tsx +++ b/packages/react-core/src/components/Nav/__tests__/Nav.test.tsx @@ -275,9 +275,9 @@ describe('Nav', () => { expect(screen.getByTestId('docked-nav')).toHaveClass(styles.modifiers.docked); }); - test(`Renders with ${styles.modifiers.textExpanded} class when isTextExpanded is true and variant is docked`, () => { + test(`Renders with ${styles.modifiers.expanded} class when isExpanded is true and variant is docked`, () => { renderNav( -