diff --git a/packages/mui-base/src/Composite/Item/CompositeItem.tsx b/packages/mui-base/src/Composite/Item/CompositeItem.tsx index 8b87646048..fac4c94c76 100644 --- a/packages/mui-base/src/Composite/Item/CompositeItem.tsx +++ b/packages/mui-base/src/Composite/Item/CompositeItem.tsx @@ -21,7 +21,7 @@ const CompositeItem = React.forwardRef(function CompositeItem( const ownerState: CompositeItem.OwnerState = React.useMemo( () => ({ - active: index === activeIndex, + highlighted: index === activeIndex, }), [index, activeIndex], ); @@ -42,7 +42,7 @@ const CompositeItem = React.forwardRef(function CompositeItem( namespace CompositeItem { export interface OwnerState { - active: boolean; + highlighted: boolean; } export interface Props extends BaseUIComponentProps<'div', OwnerState> {} diff --git a/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx b/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx index 30f23881bf..e7b9ff7b34 100644 --- a/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx +++ b/packages/mui-base/src/Composite/Root/CompositeRoot.test.tsx @@ -28,29 +28,29 @@ describe('Composite', () => { act(() => item1.focus()); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); fireEvent.keyDown(item1, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); fireEvent.keyDown(item3, { key: 'ArrowUp' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowUp' }); await flushMicrotasks(); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); expect(item1).to.have.attribute('tabindex', '0'); expect(item1).toHaveFocus(); }); @@ -70,29 +70,29 @@ describe('Composite', () => { act(() => item1.focus()); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); fireEvent.keyDown(item1, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); fireEvent.keyDown(item3, { key: 'ArrowUp' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowUp' }); await flushMicrotasks(); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); expect(item1).to.have.attribute('tabindex', '0'); expect(item1).toHaveFocus(); }); @@ -113,40 +113,40 @@ describe('Composite', () => { act(() => item1.focus()); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); fireEvent.keyDown(item1, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); fireEvent.keyDown(item1, { key: 'ArrowLeft' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowLeft' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); fireEvent.keyDown(item3, { key: 'ArrowRight' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowRight' }); await flushMicrotasks(); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); expect(item1).to.have.attribute('tabindex', '0'); expect(item1).toHaveFocus(); // loop backward fireEvent.keyDown(item1, { key: 'ArrowRight' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); }); @@ -166,41 +166,41 @@ describe('Composite', () => { act(() => item1.focus()); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); fireEvent.keyDown(item1, { key: 'ArrowLeft' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowLeft' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); fireEvent.keyDown(item3, { key: 'ArrowRight' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowRight' }); await flushMicrotasks(); - expect(item1).to.have.attribute('data-active'); + expect(item1).to.have.attribute('data-highlighted'); expect(item1).to.have.attribute('tabindex', '0'); expect(item1).toHaveFocus(); fireEvent.keyDown(item1, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item2).to.have.attribute('data-active'); + expect(item2).to.have.attribute('data-highlighted'); expect(item2).to.have.attribute('tabindex', '0'); expect(item2).toHaveFocus(); fireEvent.keyDown(item2, { key: 'ArrowDown' }); await flushMicrotasks(); - expect(item3).to.have.attribute('data-active'); + expect(item3).to.have.attribute('data-highlighted'); expect(item3).to.have.attribute('tabindex', '0'); expect(item3).toHaveFocus(); }); @@ -225,41 +225,41 @@ describe('Composite', () => { const { getByTestId } = await render(); act(() => getByTestId('1').focus()); - expect(getByTestId('1')).to.have.attribute('data-active'); + expect(getByTestId('1')).to.have.attribute('data-highlighted'); fireEvent.keyDown(getByTestId('1'), { key: 'ArrowDown' }); await flushMicrotasks(); - expect(getByTestId('4')).to.have.attribute('data-active'); + expect(getByTestId('4')).to.have.attribute('data-highlighted'); expect(getByTestId('4')).to.have.attribute('tabindex', '0'); expect(getByTestId('4')).toHaveFocus(); fireEvent.keyDown(getByTestId('4'), { key: 'ArrowRight' }); await flushMicrotasks(); - expect(getByTestId('5')).to.have.attribute('data-active'); + expect(getByTestId('5')).to.have.attribute('data-highlighted'); expect(getByTestId('5')).to.have.attribute('tabindex', '0'); expect(getByTestId('5')).toHaveFocus(); fireEvent.keyDown(getByTestId('5'), { key: 'ArrowDown' }); await flushMicrotasks(); - expect(getByTestId('8')).to.have.attribute('data-active'); + expect(getByTestId('8')).to.have.attribute('data-highlighted'); expect(getByTestId('8')).to.have.attribute('tabindex', '0'); expect(getByTestId('8')).toHaveFocus(); fireEvent.keyDown(getByTestId('8'), { key: 'ArrowLeft' }); await flushMicrotasks(); - expect(getByTestId('7')).to.have.attribute('data-active'); + expect(getByTestId('7')).to.have.attribute('data-highlighted'); expect(getByTestId('7')).to.have.attribute('tabindex', '0'); expect(getByTestId('7')).toHaveFocus(); fireEvent.keyDown(getByTestId('7'), { key: 'ArrowUp' }); await flushMicrotasks(); - expect(getByTestId('4')).to.have.attribute('data-active'); + expect(getByTestId('4')).to.have.attribute('data-highlighted'); expect(getByTestId('4')).to.have.attribute('tabindex', '0'); expect(getByTestId('4')).toHaveFocus(); act(() => getByTestId('9').focus()); await flushMicrotasks(); - expect(getByTestId('9')).to.have.attribute('data-active'); + expect(getByTestId('9')).to.have.attribute('data-highlighted'); expect(getByTestId('9')).to.have.attribute('tabindex', '0'); }); }); diff --git a/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.test.tsx b/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.test.tsx index 1a99fadc2a..1b8cd6c173 100644 --- a/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.test.tsx +++ b/packages/mui-base/src/ToggleButtonGroup/Root/ToggleButtonGroupRoot.test.tsx @@ -212,31 +212,31 @@ describe('', () => { await user.keyboard('[Tab]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); await user.keyboard('[ArrowRight]'); - expect(button2).to.have.attribute('data-active'); + expect(button2).to.have.attribute('data-highlighted'); expect(button2).to.have.attribute('tabindex', '0'); expect(button2).toHaveFocus(); await user.keyboard('[ArrowRight]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); await user.keyboard('[ArrowDown]'); - expect(button2).to.have.attribute('data-active'); + expect(button2).to.have.attribute('data-highlighted'); expect(button2).to.have.attribute('tabindex', '0'); expect(button2).toHaveFocus(); await user.keyboard('[ArrowDown]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); }); @@ -253,31 +253,31 @@ describe('', () => { await user.keyboard('[Tab]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); await user.keyboard('[ArrowLeft]'); - expect(button2).to.have.attribute('data-active'); + expect(button2).to.have.attribute('data-highlighted'); expect(button2).to.have.attribute('tabindex', '0'); expect(button2).toHaveFocus(); await user.keyboard('[ArrowLeft]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); await user.keyboard('[ArrowDown]'); - expect(button2).to.have.attribute('data-active'); + expect(button2).to.have.attribute('data-highlighted'); expect(button2).to.have.attribute('tabindex', '0'); expect(button2).toHaveFocus(); await user.keyboard('[ArrowDown]'); - expect(button1).to.have.attribute('data-active'); + expect(button1).to.have.attribute('data-highlighted'); expect(button1).to.have.attribute('tabindex', '0'); expect(button1).toHaveFocus(); });