Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Rename onDismissible to onDismiss for OuiCallOut #1008

Merged
merged 1 commit into from
Aug 31, 2023
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 src-docs/src/views/call_out/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default () => {
title="Callouts can be dismissed when dismissible is set to true unless the color is danger or warning. "
iconType="wrench"
dismissible
onDismissible={closeCallOut}
onDismiss={closeCallOut}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports[`OuiCallOut props color warning is rendered 1`] = `
exports[`OuiCallOut props dismissible close callout after click 1`] = `
<OuiCallOut
dismissible={true}
onDismissible={[MockFunction]}
onDismiss={[MockFunction]}
title="This is a callout"
>
<div
Expand Down
6 changes: 3 additions & 3 deletions src/components/call_out/call_out.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ describe('OuiCallOut', () => {
});

it('close callout after click', () => {
const onDismissible = jest.fn();
const onDismiss = jest.fn();
const component = mount(
<OuiCallOut
dismissible={true}
onDismissible={onDismissible}
onDismiss={onDismiss}
title="This is a callout"
/>
);
expect(component).toMatchSnapshot();
findTestSubject(component, 'closeCallOutButton').simulate('click');
expect(onDismissible).toBeCalled();
expect(onDismiss).toBeCalled();
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/components/call_out/call_out.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type OuiCallOutProps = CommonProps &
size?: Size;
heading?: Heading;
dismissible?: boolean;
onDismissible?: (
onDismiss?: (
event?:
| React.KeyboardEvent<HTMLDivElement>
| React.MouseEvent<HTMLButtonElement>
Expand Down Expand Up @@ -83,7 +83,7 @@ export const OuiCallOut = forwardRef<HTMLDivElement, OuiCallOutProps>(
className,
heading,
dismissible = false,
onDismissible = () => {},
onDismiss = () => {},
...rest
},
ref: Ref<HTMLDivElement>
Expand Down Expand Up @@ -114,7 +114,7 @@ export const OuiCallOut = forwardRef<HTMLDivElement, OuiCallOutProps>(
dismissibleIcon = (
<OuiButtonIcon
iconType="cross"
onClick={onDismissible}
onClick={onDismiss}
className="ouiCallOut__closeIcon"
aria-label="dismissible_icon"
data-test-subj="closeCallOutButton"
Expand Down