@@ -72,4 +72,77 @@ describe('va-featured-content', () => {
await axeCheck(page);
});
+
+ it('renders v3', async () => {
+ const page = await newE2EPage();
+ await page.setContent(`
+
+
+ If I'm a Veteran, can I get VR&E benefits and services?
+
+ You may be eligible for VR&E benefits and services if you're a Veteran, and you meet all of the requirements listed below.
+ All of these must be true. You:
+
+ - Didn't receive a dishonorable discharge, and
+ - Have a service-connected disability rating of at least 10% from VA, and
+ - Apply for VR&E services
+
+
+ `);
+ const element = await page.find('va-featured-content');
+
+ expect(element).toEqualHtml(`
+
+
+
+
+ If I'm a Veteran, can I get VR&E benefits and services?
+ You may be eligible for VR&E benefits and services if you're a Veteran, and you meet all of the requirements listed below.
+ All of these must be true. You:
+
+ - Didn't receive a dishonorable discharge, and
+ - Have a service-connected disability rating of at least 10% from VA, and
+ - Apply for VR&E services
+
+
+ `);
+ });
+
+ it("renders the heading passed to the 'headline' slot", async () => {
+ const heading = "If I'm a Veteran, can I get VR&E benefits and services?";
+ const page = await newE2EPage();
+ await page.setContent(`
+
+ ${heading}
+
+ `);
+ const element = await page.find('h3');
+ expect(element).not.toBeNull();
+ expect(element).toEqualText(heading);
+ });
+
+ it('passes an axe check', async () => {
+ const page = await newE2EPage();
+ await page.setContent(`
+
+
+ If I'm a Veteran, can I get VR&E benefits and services?
+
+ You may be eligible for VR&E benefits and services if you're a Veteran, and you meet all of the requirements listed below.
+ All of these must be true. You:
+
+ - Didn't receive a dishonorable discharge, and
+ - Have a service-connected disability rating of at least 10% from VA, and
+ - Apply for VR&E services
+
+
+ `);
+
+ await axeCheck(page);
+ });
});
diff --git a/packages/web-components/src/components/va-featured-content/va-featured-content.css b/packages/web-components/src/components/va-featured-content/va-featured-content.scss
similarity index 74%
rename from packages/web-components/src/components/va-featured-content/va-featured-content.css
rename to packages/web-components/src/components/va-featured-content/va-featured-content.scss
index d41e7bc1d..b96148e95 100644
--- a/packages/web-components/src/components/va-featured-content/va-featured-content.css
+++ b/packages/web-components/src/components/va-featured-content/va-featured-content.scss
@@ -1,3 +1,13 @@
+@forward 'settings';
+
+@use 'usa-summary-box/src/styles/usa-summary-box';
+@import '../../global/formation_overrides';
+
+.usa-summary-box {
+ font-size: 16px;
+ border-radius: 4px;
+}
+
:host {
display: block;
}
diff --git a/packages/web-components/src/components/va-featured-content/va-featured-content.tsx b/packages/web-components/src/components/va-featured-content/va-featured-content.tsx
index 460df87c6..dfd53da2e 100644
--- a/packages/web-components/src/components/va-featured-content/va-featured-content.tsx
+++ b/packages/web-components/src/components/va-featured-content/va-featured-content.tsx
@@ -1,4 +1,4 @@
-import { Component, Host, h } from '@stencil/core';
+import { Component, Host, h, Prop, Element } from '@stencil/core';
/**
* @componentName Featured content
@@ -7,18 +7,53 @@ import { Component, Host, h } from '@stencil/core';
*/
@Component({
tag: 'va-featured-content',
- styleUrl: 'va-featured-content.css',
+ styleUrl: 'va-featured-content.scss',
shadow: true,
})
export class VaFeaturedContent {
+ /**
+ * Whether or not the component will use USWDS v3 styling.
+ */
+ @Prop() uswds?: boolean = false;
+
+ @Element() el: HTMLElement;
+
+ componentDidLoad() {
+ if (!this.uswds) {
+ return
+ }
+ // add uswds classes
+ const nodes = this.el.shadowRoot
+ .querySelectorAll('slot')
+ const headline = nodes[0];
+ const content = nodes[1];
+
+ headline.classList.add('usa-summary-box__heading');
+ content.classList.add('usa-summary-box__text');
+ }
+
render() {
- return (
-
-
-
-
-
-
- );
+ const { uswds } = this;
+ if (uswds) {
+ return (
+
+
+
+ );
+ } else {
+ return (
+
+
+
+
+
+
+ );
+ }
}
}