Skip to content

Commit a2e2d0e

Browse files
committed
refactor(react-popover): remove isolated unit tests for getPopoverSurfaceAriaAttributes
- Remove isolated unit tests for getPopoverSurfaceAriaAttributes function - Keep component-level integration tests that verify aria attributes through rendered component - Update function comment to remove mention of isolated testing - Component logic is now tested as a whole rather than in isolation
1 parent 1a1be75 commit a2e2d0e

2 files changed

Lines changed: 0 additions & 36 deletions

File tree

packages/react-components/react-popover/library/src/components/PopoverSurface/PopoverSurface.test.tsx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { resetIdsForTests } from '@fluentui/react-utilities';
22
import * as React from 'react';
33
import { PopoverSurface } from './PopoverSurface';
4-
import { getPopoverSurfaceAriaAttributes } from './usePopoverSurface';
54
import { render, fireEvent } from '@testing-library/react';
65
import { isConformant } from '../../testing/isConformant';
76
import { mockPopoverContext } from '../../testing/mockUsePopoverContext';
@@ -83,37 +82,3 @@ describe('PopoverSurface', () => {
8382
expect(getByTestId(testid).getAttribute('role')).toEqual('group');
8483
});
8584
});
86-
87-
describe('getPopoverSurfaceAriaAttributes', () => {
88-
it('returns dialog attributes when focus is trapped', () => {
89-
expect(
90-
getPopoverSurfaceAriaAttributes({
91-
hasAccessibleName: false,
92-
trapFocus: true,
93-
}),
94-
).toEqual({
95-
role: 'dialog',
96-
'aria-modal': true,
97-
});
98-
});
99-
100-
it('returns group when the surface has an accessible name', () => {
101-
expect(
102-
getPopoverSurfaceAriaAttributes({
103-
hasAccessibleName: true,
104-
trapFocus: false,
105-
}),
106-
).toEqual({
107-
role: 'group',
108-
});
109-
});
110-
111-
it('returns no role when the surface is unlabelled', () => {
112-
expect(
113-
getPopoverSurfaceAriaAttributes({
114-
hasAccessibleName: false,
115-
trapFocus: false,
116-
}),
117-
).toEqual({});
118-
});
119-
});

packages/react-components/react-popover/library/src/components/PopoverSurface/usePopoverSurface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ type PopoverSurfaceAriaAttributes = Pick<React.HTMLAttributes<HTMLDivElement>, '
1212
/**
1313
* Returns the ARIA role and modal attributes for a PopoverSurface.
1414
*
15-
* Extracted as a pure function to allow isolated unit testing of the attribute logic.
1615
* - `trapFocus=true` → `role="dialog"` + `aria-modal=true`
1716
* - `trapFocus=false` + accessible name present → `role="group"`
1817
* - `trapFocus=false` + no accessible name → no role (plain div avoids screen reader

0 commit comments

Comments
 (0)