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

Commit

Permalink
[terra-hyperlink] Added missing data attribute for type default varia…
Browse files Browse the repository at this point in the history
…nt (#4104)
  • Loading branch information
MadanKumarGovindaswamy authored May 24, 2024
1 parent 5ecb145 commit fd88a8d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/terra-hyperlink/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Fixed
* Added missing data attribute for default variant.

## 2.70.0 - (May 8, 2024)

* Changed
Expand Down
1 change: 1 addition & 0 deletions packages/terra-hyperlink/src/Hyperlink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class Hyperlink extends React.Component {
role="link"
type="button"
ref={this.linkRef}
data-focus-styles-enabled
>
<span className={cx('button-inner')}>
<span className={cx('inner-text')}>
Expand Down
9 changes: 8 additions & 1 deletion packages/terra-hyperlink/tests/jest/Hyperlink.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ describe('Hyperlink', () => {
expect(wrapper).toMatchSnapshot();
});

it('should render a hyperlink button when oonClick is provided', () => {
it('should render a hyperlink button when onClick is provided', () => {
const wrapper = enzymeIntl.renderWithIntl(<Hyperlink text="Default hyperlink button" onClick={() => {}} />);
expect(wrapper).toMatchSnapshot();
});

it('should render a default hyperlink button with data styling attribute', () => {
const wrapper = enzymeIntl.renderWithIntl(<Hyperlink text="Default hyperlink button" onClick={() => {}} />);
expect(wrapper.find('data-focus-styles-enabled')).toBeDefined();
expect(wrapper.prop('data-focus-styles-enabled')).toEqual('true');
expect(wrapper).toMatchSnapshot();
});

it('correctly applies the theme context className', () => {
const wrapper = enzymeIntl.mountWithIntl(
<ThemeContextProvider theme={{ className: 'orion-fusion-theme' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ exports[`Hyperlink should render a default hyperlink 1`] = `
</a>
`;

exports[`Hyperlink should render a default hyperlink button with data styling attribute 1`] = `
<button
class="button-reset hyperlink default"
data-focus-styles-enabled="true"
role="link"
type="button"
>
<span
class="button-inner"
>
<span
class="inner-text"
>
Default hyperlink button
</span>
</span>
</button>
`;

exports[`Hyperlink should render a disabled hyperlink 1`] = `
<a
aria-disabled="true"
Expand Down Expand Up @@ -229,9 +248,10 @@ exports[`Hyperlink should render a external hyperlink 1`] = `
</a>
`;

exports[`Hyperlink should render a hyperlink button when oonClick is provided 1`] = `
exports[`Hyperlink should render a hyperlink button when onClick is provided 1`] = `
<button
class="button-reset hyperlink default"
data-focus-styles-enabled="true"
role="link"
type="button"
>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fd88a8d

Please sign in to comment.