Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@react-aria/utils/src/filterDOMProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function filterDOMProps(props: DOMProps & AriaLabelingProps & LinkDOMProp
(labelable && labelablePropNames.has(prop)) ||
(isLink && linkPropNames.has(prop)) ||
(global && globalAttrs.has(prop)) ||
(events && globalEvents.has(prop) || (prop.endsWith('Capture') && globalEvents.has(prop.slice(0, -7)))) ||
(events && (globalEvents.has(prop) || (prop.endsWith('Capture') && globalEvents.has(prop.slice(0, -7))))) ||
propNames?.has(prop) ||
propRe.test(prop)
)
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ describe('Button', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getByRole} = render(<Button className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick}>Test</Button>);
let onClickCapture = jest.fn();
let {getByRole} = render(<Button className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick} onClickCapture={onClickCapture}>Test</Button>);
let button = getByRole('button');

expect(button).not.toHaveAttribute('data-pressed');
Expand All @@ -140,6 +141,7 @@ describe('Button', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support disabled state', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/Checkbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ describe('Checkbox', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getByRole} = render(<Checkbox className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick}>Test</Checkbox>);
let onClickCapture = jest.fn();
let {getByRole} = render(<Checkbox className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick} onClickCapture={onClickCapture}>Test</Checkbox>);
let checkbox = getByRole('checkbox').closest('label');

expect(checkbox).not.toHaveAttribute('data-pressed');
Expand All @@ -141,6 +142,7 @@ describe('Checkbox', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support press state with keyboard', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/Link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ describe('Link', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getByRole} = render(<Link className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick}>Test</Link>);
let onClickCapture = jest.fn();
let {getByRole} = render(<Link className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick} onClickCapture={onClickCapture}>Test</Link>);
let link = getByRole('link');

expect(link).not.toHaveAttribute('data-pressed');
Expand All @@ -126,6 +127,7 @@ describe('Link', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support disabled state', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/Menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1449,11 +1449,12 @@ describe('Menu', () => {
let onPressEnd = jest.fn();
let onPress = jest.fn();
let onClick = jest.fn();
let onClickCapture = jest.fn();
let tree = render(
<MenuTrigger>
<Button>Menu Button</Button>
<Popover>
<TestMenu itemProps={{onAction, onPressStart, onPressEnd, onPress, onClick}} />
<TestMenu itemProps={{onAction, onPressStart, onPressEnd, onPress, onClick, onClickCapture}} />
</Popover>
</MenuTrigger>
);
Expand All @@ -1467,6 +1468,7 @@ describe('Menu', () => {
expect(onPressEnd).toHaveBeenCalledTimes(1);
expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support press events on menu items with closeOnSelect: false', async function () {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/RadioGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ describe('RadioGroup', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getAllByRole} = renderGroup({}, {className: ({isPressed}) => isPressed ? 'pressed' : '', onClick, onPress});
let onClickCapture = jest.fn();
let {getAllByRole} = renderGroup({}, {className: ({isPressed}) => isPressed ? 'pressed' : '', onClick, onPress, onClickCapture});
let radio = getAllByRole('radio')[0].closest('label');

expect(radio).not.toHaveAttribute('data-pressed');
Expand All @@ -185,6 +186,7 @@ describe('RadioGroup', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support press state with keyboard', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/Switch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ describe('Switch', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getByRole} = render(<Switch className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick}>Test</Switch>);
let onClickCapture = jest.fn();
let {getByRole} = render(<Switch className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick} onClickCapture={onClickCapture}>Test</Switch>);
let s = getByRole('switch').closest('label');

expect(s).not.toHaveAttribute('data-pressed');
Expand All @@ -157,6 +158,7 @@ describe('Switch', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support press state with keyboard', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-aria-components/test/ToggleButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ describe('ToggleButton', () => {
it('should support press state', async () => {
let onPress = jest.fn();
let onClick = jest.fn();
let {getByRole} = render(<ToggleButton className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick}>Test</ToggleButton>);
let onClickCapture = jest.fn();
let {getByRole} = render(<ToggleButton className={({isPressed}) => isPressed ? 'pressed' : ''} onPress={onPress} onClick={onClick} onClickCapture={onClickCapture}>Test</ToggleButton>);
let button = getByRole('button');

expect(button).not.toHaveAttribute('data-pressed');
Expand All @@ -112,6 +113,7 @@ describe('ToggleButton', () => {

expect(onPress).toHaveBeenCalledTimes(1);
expect(onClick).toHaveBeenCalledTimes(1);
expect(onClickCapture).toHaveBeenCalledTimes(1);
});

it('should support disabled state', () => {
Expand Down
Loading