-
Notifications
You must be signed in to change notification settings - Fork 6
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
19386 checklist template #810
Draft
randimays
wants to merge
60
commits into
Sitewide-integration
Choose a base branch
from
19386-checklist-template
base: Sitewide-integration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
b560102
Update Design System dependencies to latest (#812)
randimays 9c897e6
VACMS-19386 Add SecondaryButtonGroup and RelatedLinks common componen…
randimays f0e34ee
VACMS-19386 Cleanup in support of checklist template (#815)
randimays 7ad14c6
VACMS-19386 Update contact info component (#821)
randimays 227eb06
VACMS-19386 Checklist template migration
randimays 4819198
Adding more types and finishing query for checklist
randimays 99de1a6
Adding imports to get the page to load
randimays d7fa5b0
Removed unused Link custom component; added secondaryButtonGroup for …
randimays 54606dd
Add optional intro
randimays 75cdadc
Trying to get the nested checklist paragraph to work
randimays 6470ba1
Got checklist data fetching properly
randimays ce86322
Adding more content for checklist page
randimays cdf3fae
Adding some Medallia code
randimays 0da2da8
Updating design system, fixing tags issues, still working on web comp…
randimays 0de6967
Adding related information shared component
randimays bf9b520
Added benefit hubs links
randimays f34614c
Tweaks to tags for styling. Add next-template data to all things in t…
randimays b7b8604
A few more updates for data- attributes
randimays 7de55c7
Updating responsive behavior in the contentFooter
randimays 118b454
Adding mock and tests for data query
randimays e4fe3b9
One more data query test update
randimays dcef5ba
Adding tests for checklist item and updating plop test template
randimays bd66f33
Checklist item test adjustment
randimays a8b83d8
Remove unneeded files
randimays 904c215
Adding and updating unit tests
randimays 732c1a4
Update unit tests
randimays 0a59ffd
More unit test tweaks
randimays feea986
Adding/updating more unit tests
randimays 3d0acc9
Removing storybook files
randimays d28c7e5
Fixing type errors
randimays 200d06c
Fixing more type errors
randimays 252457b
Adding playwright test
randimays 1e79388
Adding back props that were removed in NodeAbstractResource
randimays 99927a8
Revert Taxonomy Term to former structure (empty)
randimays 8a43d0d
Trying to revert dependency updates
randimays 78be2fd
Fixing some typescript issues
randimays 5d8a15c
More types fixes
randimays 7fc4213
Updating types
randimays d5bf913
Fixing types for contact info
randimays 282d44a
Refactor related information component to be shared
randimays 710c500
Consolidated shared related links component, fix more types
randimays 53302ef
Consolidated shared related links component, fix more types
randimays 6f2af66
Fixing more types in the tests
randimays 3b72a48
Fixed all the types
randimays cf79c64
Fixing some tests and errors
randimays 3faaeac
Reverting API playground
randimays 50d8228
Updating design library dependencies
randimays 928efff
Fixing some tests
randimays fb94a8c
Prettier formatting
randimays 5007b3f
Updating snapshots
randimays 590ddd2
Fixing test
randimays 8972f97
Remove next component data attributes
randimays bbc0915
Upgrading design system dependencies again
randimays ea2e754
Attempting to fix dependencies and web component issues
randimays 42a262e
Revert unnecessary updates for data-templates etc
randimays 43424be
Updating DS dependencies
randimays 3105db8
Trying to fix yarn cache
randimays 621f9f1
Updating dependencies
randimays 72b188f
Updating snapshots
randimays aa50db8
Reverting contact info back to the original
randimays File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file removed
BIN
-723 KB
...he/@department-of-veterans-affairs-component-library-npm-45.0.0-69f993e95a-e9ef80ff5f.zip
Binary file not shown.
Binary file added
BIN
+659 KB
...he/@department-of-veterans-affairs-component-library-npm-48.0.1-61178d9ee8-05df1e119d.zip
Binary file not shown.
Binary file removed
BIN
-200 KB
.yarn/cache/@department-of-veterans-affairs-css-library-npm-0.8.8-e62b6ff3c0-73835d1424.zip
Binary file not shown.
Binary file renamed
BIN
+4.15 MB
...ion-npm-11.0.26-75c393c980-18ecdfb232.zip → ...tion-npm-12.0.0-2c132930f9-e686433f5f.zip
Binary file not shown.
Binary file removed
BIN
-3.1 MB
...cache/@department-of-veterans-affairs-web-components-npm-11.2.9-41f4d5cabf-bb578c1e8e.zip
Binary file not shown.
Binary file removed
BIN
-2.53 MB
...cache/@department-of-veterans-affairs-web-components-npm-13.0.0-2f3c383de5-b9732eae26.zip
Binary file not shown.
Binary file added
BIN
+2.32 MB
...cache/@department-of-veterans-affairs-web-components-npm-16.0.1-1da5e33457-63cb0a4a66.zip
Binary file not shown.
Binary file removed
BIN
-14 KB
.yarn/cache/@divriots-style-dictionary-to-figma-npm-0.4.0-c66bec7fc2-122dd221fa.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import { {{pascalCase name}} } from '@/types/drupal/node' | ||
import { queries } from '@/data/queries' | ||
import mockData from '@/mocks/{{camelCase name}}.mock.json' | ||
|
||
const {{pascalCase name}}Mock: {{pascalCase name}} = mockData | ||
|
||
describe('{{pascalCase name}} formatData', () => { | ||
let windowSpy | ||
|
||
beforeEach(() => { | ||
windowSpy = jest.spyOn(window, 'window', 'get') | ||
}) | ||
|
||
afterEach(() => { | ||
windowSpy.mockRestore() | ||
// remove if this component does not have a data fetch | ||
describe('DrupalJsonApiParams configuration', () => { | ||
test('params function sets the correct include fields', () => { | ||
// TODO | ||
}) | ||
}) | ||
|
||
describe('{{pascalCase name}} formatData', () => { | ||
test('outputs formatted data', () => { | ||
windowSpy.mockImplementation(() => undefined) | ||
|
||
expect( | ||
queries.formatData('node--{{snakeCase name}}', {{pascalCase name}}Mock) | ||
).toMatchSnapshot() | ||
}) | ||
|
||
test('handles no answers correctly', () => { | ||
// TODO | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { test, expect } from '../utils/next-test' | ||
|
||
test.describe('Checklist', () => { | ||
test('Checklist page renders', async ({ page }) => { | ||
await page.goto( | ||
'/resources/what-to-bring-to-create-your-online-sign-in-account' | ||
) | ||
await expect(page).toHaveURL( | ||
'/resources/what-to-bring-to-create-your-online-sign-in-account' | ||
) | ||
}) | ||
|
||
test('Should render without a11y errors', async ({ | ||
page, | ||
makeAxeBuilder, | ||
}) => { | ||
await page.goto( | ||
'/resources/what-to-bring-to-create-your-online-sign-in-account' | ||
) | ||
|
||
const accessibilityScanResults = await makeAxeBuilder().analyze() | ||
|
||
expect(accessibilityScanResults.violations).toEqual([]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
import { QueryFormatter, QueryParams } from 'next-drupal-query' | ||
import { NodeLandingPage } from '@/types/drupal/node' | ||
import { BenefitsHubLink } from '@/types/formatted/benefitsHub' | ||
import { RelatedLink } from '@/types/formatted/relatedLinks' | ||
import { DrupalJsonApiParams } from 'drupal-jsonapi-params' | ||
|
||
// Define the query params for fetching node--landing_page. | ||
export const params: QueryParams<null> = () => { | ||
return new DrupalJsonApiParams().addInclude(['field_support_services']) | ||
} | ||
|
||
// Format NodeLandingPage (Benefits Hub) into link teasers. | ||
export const formatter: QueryFormatter<NodeLandingPage[], BenefitsHubLink[]> = ( | ||
export const formatter: QueryFormatter<NodeLandingPage[], RelatedLink[]> = ( | ||
entities: NodeLandingPage[] | ||
) => { | ||
return entities.map((entity) => { | ||
return { | ||
id: entity.id, | ||
path: entity.path?.alias, | ||
title: entity.title, | ||
label: entity.field_home_page_hub_label, | ||
teaserText: entity.field_teaser_text, | ||
uri: entity.path?.alias, | ||
title: entity.field_home_page_hub_label, | ||
summary: entity.field_teaser_text, | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { QueryData, QueryFormatter, QueryParams } from 'next-drupal-query' | ||
import { DrupalJsonApiParams } from 'drupal-jsonapi-params' | ||
import { queries } from '.' | ||
import { formatParagraph } from '@/lib/drupal/paragraphs' | ||
import { | ||
PARAGRAPH_RESOURCE_TYPES, | ||
RESOURCE_TYPES, | ||
} from '@/lib/constants/resourceTypes' | ||
import { ExpandedStaticPropsContext } from '@/lib/drupal/staticProps' | ||
import { | ||
entityBaseFields, | ||
fetchSingleEntityOrPreview, | ||
} from '@/lib/drupal/query' | ||
import { getNestedIncludes } from '@/lib/utils/queries' | ||
|
||
// Types | ||
import { AlertSingle } from '@/types/formatted/alert' | ||
import { AudienceTopics } from '@/types/formatted/audienceTopics' | ||
import { Button } from '@/types/formatted/button' | ||
import { Checklist, ChecklistItem } from '@/types/formatted/checklist' | ||
import { ContactInfo } from '@/types/formatted/contactInfo' | ||
import { NodeChecklist } from '@/types/drupal/node' | ||
import { RelatedLink } from '@/types/formatted/relatedLinks' | ||
|
||
export const params: QueryParams<null> = () => { | ||
return new DrupalJsonApiParams().addInclude([ | ||
...getNestedIncludes( | ||
'field_alert_single', | ||
PARAGRAPH_RESOURCE_TYPES.ALERT_SINGLE | ||
), | ||
'field_buttons', | ||
'field_checklist.field_checklist_sections', | ||
...getNestedIncludes( | ||
'field_contact_information', | ||
PARAGRAPH_RESOURCE_TYPES.CONTACT_INFORMATION | ||
), | ||
'field_related_benefit_hubs', | ||
'field_related_information', | ||
...getNestedIncludes( | ||
'field_tags', | ||
PARAGRAPH_RESOURCE_TYPES.AUDIENCE_TOPICS | ||
), | ||
]) | ||
} | ||
|
||
export type ChecklistDataOpts = { | ||
id: string | ||
context?: ExpandedStaticPropsContext | ||
} | ||
|
||
export const data: QueryData<ChecklistDataOpts, NodeChecklist> = async ( | ||
opts | ||
): Promise<NodeChecklist> => { | ||
const entity = (await fetchSingleEntityOrPreview( | ||
opts, | ||
RESOURCE_TYPES.CHECKLIST, | ||
params | ||
)) as NodeChecklist | ||
|
||
return entity | ||
} | ||
|
||
export const formatter: QueryFormatter<NodeChecklist, Checklist> = ( | ||
entity: NodeChecklist | ||
) => { | ||
const formatRelatedLinks = (links): RelatedLink[] => | ||
links?.map((link) => ({ | ||
uri: link?.field_link?.uri, | ||
title: link?.field_link?.title, | ||
summary: link.field_link_summary, | ||
})) | ||
|
||
return { | ||
...entityBaseFields(entity), | ||
alert: formatParagraph(entity.field_alert_single) as AlertSingle, | ||
benefitsHubLinks: queries.formatData( | ||
RESOURCE_TYPES.BENEFITS_HUB, | ||
entity.field_related_benefit_hubs | ||
), | ||
buttons: entity.field_buttons.map?.(formatParagraph) as Button[], | ||
checklist: entity.field_checklist.field_checklist_sections?.map((section) => | ||
queries.formatData(PARAGRAPH_RESOURCE_TYPES.CHECKLIST, section) | ||
) as ChecklistItem[], | ||
contactInformation: formatParagraph( | ||
entity.field_contact_information | ||
) as ContactInfo, | ||
intro: entity.field_intro_text_limited_html.processed, | ||
relatedInformation: formatRelatedLinks(entity.field_related_information), | ||
repeatButtons: entity.field_buttons_repeat, | ||
tags: formatParagraph(entity.field_tags) as AudienceTopics, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { QueryFormatter } from 'next-drupal-query' | ||
import { ParagraphChecklistItem } from '@/types/drupal/paragraph' | ||
import { ChecklistItem } from '@/types/formatted/checklist' | ||
|
||
export const formatter: QueryFormatter< | ||
ParagraphChecklistItem, | ||
ChecklistItem | ||
> = (entity: ParagraphChecklistItem) => { | ||
return { | ||
type: entity.type as ChecklistItem['type'], | ||
id: entity.id, | ||
items: entity.field_checklist_items, | ||
header: entity.field_section_header, | ||
intro: entity.field_section_intro, | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was missing logic to handle a single object of beneficiaries rather than an array, so I added a formatter function instead.