Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-application-links] add onTabClick optional property to terra-application-links interface #2113

Merged
merged 9 commits into from
Apr 12, 2024

Conversation

sPavl0v
Copy link
Contributor

@sPavl0v sPavl0v commented Apr 1, 2024

Summary

Would like to add new property to provide an ability to add custom handler on link click.
What was changed:
Expose onTabClick property to a public interface of terra-application-links.
Change logic to trigger the callback when it's provided

Why it was changed:
There is a need to pass a callback function when link clicked

Testing

This change was tested using:

  • Jest

Reviews

In addition to engineering reviews, this PR needs:

  • UX review
  • Accessibility review
  • Functional review

Additional Details

This PR resolves:

UXPLATFORM-XXXX


Thank you for contributing to Terra.
@cerner/terra

@sPavl0v sPavl0v self-assigned this Apr 1, 2024
@github-actions github-actions bot temporarily deployed to preview-pr-2113 April 1, 2024 13:25 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2113 April 3, 2024 11:42 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2113 April 3, 2024 20:42 Destroyed
@@ -11,6 +11,11 @@ it('should render ApplicationTabs with links and alignment', () => {
expect(wrapper).toMatchSnapshot();
});

it('should render ApplicationTabs with links and alignment and onTabClick handler', () => {
const wrapper = enzyme.shallow(<div><ApplicationTabs links={testLinkConfig} alignment="start" onTabClick={() => {}} /></div>);
expect(wrapper).toMatchSnapshot();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a test that onTabClick is called when clicking the tab and avoid using snapshots? Here is an example:

expect(handleOnClickOracle).toHaveBeenCalled();

packages/terra-application-links/CHANGELOG.md Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to preview-pr-2113 April 10, 2024 09:28 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-2113 April 10, 2024 13:15 Destroyed
@sPavl0v sPavl0v requested a review from sycombs April 10, 2024 19:49
@sPavl0v sPavl0v merged commit 249ab1c into main Apr 12, 2024
22 checks passed
@sPavl0v sPavl0v deleted the terra-application-links-ontabclick branch April 12, 2024 10:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants