feat: Table Column Groups Collection Prefs#4487
Conversation
aef643e to
d30a4c0
Compare
3eb8ca8 to
ba91764
Compare
ba91764 to
8e47ee3
Compare
652c9fc to
2b8739b
Compare
a540dbe to
ba9eff6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4487 +/- ##
=======================================
Coverage 97.41% 97.41%
=======================================
Files 933 933
Lines 29595 29681 +86
Branches 10757 10791 +34
=======================================
+ Hits 28831 28915 +84
- Misses 716 718 +2
Partials 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ba9eff6 to
3388a83
Compare
|
|
||
| describe('Collection preferences - Grouped Content Display', () => { | ||
| test( | ||
| 'renders group headers and leaf options', |
There was a problem hiding this comment.
I'd cover this in unit tests since they're cheaper to run. Is there anything browser-specific that jsdom can't reproduce? Looks like only drag and drop really needs integ tests in this file, the rest could be unit tests
| const toggle = firstOption.findVisibilityToggle().findNativeInput(); | ||
|
|
||
| // Toggle visibility | ||
| await page.click(toggle.toSelector()); |
There was a problem hiding this comment.
We typically write an assertion statement after an event
|
|
||
| // Order should have changed | ||
| const newTexts = await page.getElementsText(options.toSelector()); | ||
| expect(newTexts).not.toEqual(initialTexts); |
There was a problem hiding this comment.
I'd suggest explicitly checking options order after drag and drop and introduce more complex scenarios such as:
- drag and drop for groups
- drag and drop for individual items
| const wrapper = renderGroupedContentDisplay(); | ||
| const options = wrapper.findOptions(); | ||
| // Should render all 4 options (id1 ungrouped + id2, id3 in g1 + id4 in g2) | ||
| expect(options.length).toBeGreaterThanOrEqual(4); |
There was a problem hiding this comment.
I'd suggest to explicitly check the content of the options
| // id1 is visible, id2 is visible, id3 is not visible, id4 is visible | ||
| const toggleStates = options.map(opt => opt.findVisibilityToggle().findNativeInput().getElement().checked); | ||
| // At minimum, not all should be checked (id3 is false) | ||
| expect(toggleStates).toContain(false); |
There was a problem hiding this comment.
Same - check explicitly what is inside the array
| i18nStrings, | ||
| sortDisabled, | ||
| }: { | ||
| node: OptionTreeNode & { type: 'group' }; |
There was a problem hiding this comment.
Why the type: group isn't a part of the OptionTreeNode?
| node: OptionTreeNode & { type: 'group' }; | ||
| onToggle: (id: string) => void; | ||
| onChildrenChange: (children: OptionTreeNode[]) => void; | ||
| i18nStrings: React.ComponentProps<typeof InternalList>['i18nStrings']; |
There was a problem hiding this comment.
[nit] you can import underlying interface DndAreaI18nStrings directly from src/internal/components/sortable-area/interfaces.ts
| i18nStrings={i18nStrings} | ||
| onSortingChange={ | ||
| // istanbul ignore next: requires DnD interaction | ||
| ({ detail: { items } }) => onTreeChange([...items]) |
There was a problem hiding this comment.
you can actually test this event same way as in src/file-dropzone/__tests__/file-dropzone.test.tsx
| id: node.id, | ||
| announcementLabel: | ||
| node.type === 'group' | ||
| ? `${node.label}, ${node.children.length} items` |
There was a problem hiding this comment.
should it come from i18n strings?
| const result: string[] = []; | ||
| for (const item of items) { | ||
| if (item.type === 'group') { | ||
| // istanbul ignore next: covered by integration tests |
Description
Add Table Column Grouping Feature support in collection preferences.
Related links, issue AWSUI-9594, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.