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

va-link: Replacing external icon with text #1396

Merged
merged 6 commits into from
Nov 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ describe('va-link', () => {
<va-link class="hydrated" external="" href="https://www.va.gov" text="Veteran's Affairs">
<mock:shadow-root>
<a href="https://www.va.gov" rel="noreferrer" class="link--center" target="_blank">
Veteran's Affairs
<va-icon class="external-link-icon hydrated"></va-icon>
Veteran's Affairs (opens in a new tab)
<span class="usa-sr-only">
opens in a new tab
</span>
Expand All @@ -187,10 +186,12 @@ describe('va-link', () => {

it('renders a link with a screen reader label', async () => {
const page = await newE2EPage();
await page.setContent(`<va-link href="https://www.va.gov" text="Veteran's Affairs" label="Example label" />`);
await page.setContent(
`<va-link href="https://www.va.gov" text="Veteran's Affairs" label="Example label" />`,
);

const label = await page.find('va-link >>> a[aria-label]');
expect(label.getAttribute("aria-label")).toBe('Example label');
expect(label.getAttribute('aria-label')).toBe('Example label');
});

it('passes an axe check', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ export class VaLink {
onClick={handleClick}
target="_blank"
>
{text}
<va-icon class="external-link-icon" icon="launch"></va-icon>
{text} (opens in a new tab)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have flagged a visual change in Chromatic on the va-link and va-statement-of-truth stories at a minimum. Can you try toggling the onlyChanged flag to see if that picks it up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do!

<span class="usa-sr-only">opens in a new tab</span>
</a>
</Host>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ describe('va-privacy-agreement', () => {
<va-checkbox class="hydrated" id="checkbox">
<span class="description" slot="description">
Please read and accept the
<a href="/privacy-policy/" target="_blank">
privacy policy
<va-icon class="hydrated privacy-policy-icon"></va-icon>
<span class="usa-sr-only">opens in a new window</span>
</a>.
<va-link class="hydrated"></va-link>.
Copy link
Contributor

@jamigibbs jamigibbs Nov 14, 2024

Choose a reason for hiding this comment

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

I am surprised this test doesn't expect more details on the link. 🤔 Like these attributes:

href="/privacy-policy/"
text="privacy policy"
external

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was surprised by that too. Good thing we still have separate e2e tests for the va-link component itself to make sure those props work!

</span>
</va-checkbox>
</mock:shadow-root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,11 @@ export class VaPrivacyAgreement {
>
<span class={`${labelClass} description`} slot="description">
Please read and accept the&nbsp;
<a href="/privacy-policy/" target="_blank">
privacy policy

<va-icon
class="privacy-policy-icon"
icon="launch"
size={2}
></va-icon>
<span class="usa-sr-only">
opens in a new window
</span>
</a>
<va-link
href="/privacy-policy/"
text="privacy policy"
external
></va-link>
.
</span>
</va-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
margin: 24px;
}

@media screen and (max-width: $small-screen) {
:host .short-line {
width: var(--vads-size-line-length-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to see this new token coming in handy!

}
}

:host va-text-input {
margin-bottom: 24px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ export class VaStatementOfTruth {
<article>
<h3>{heading}</h3>
<slot></slot>
<p class="font-sans-6">
<p class="font-sans-6 short-line">
I have read and accept the&nbsp;
<va-link external text='privacy policy' href='/privacy-policy/' />
.
<va-link external text="privacy policy" href="/privacy-policy/" />.
</p>
<va-text-input
id="veteran-signature"
Expand Down
Loading