-
Notifications
You must be signed in to change notification settings - Fork 68
LG-4899: getLgIds #2786
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
Merged
Merged
LG-4899: getLgIds #2786
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
e584c08
checkboc lgids
shaneeza d44a0cf
confirmation modal lgids
shaneeza 6a99af1
checkbox specs
shaneeza e755469
checkbox testUtils type
shaneeza 17645b5
form-field lgids
shaneeza 576a2aa
confirmation modal use root for lgids
shaneeza b55f264
form footer getLgIds
shaneeza f842ab0
add DEFAULT_LGID_ROOT import
shaneeza 9b86e59
passwordInput getLgIds
shaneeza 454e56e
tabs getLgIds
shaneeza 19ef955
textArea getLgIds
shaneeza 9e96a8a
textInput getLgIds
shaneeza c9b60f1
toggle getLgIds
shaneeza 113f1ae
table getLgIds
shaneeza 6ebbdcc
menu getLgIds
shaneeza 3d36ccb
splitButton getLgIds
shaneeza f760242
select getLgIds
shaneeza a49c5a8
typography getLgIds
shaneeza a286f9b
fix failing tests
shaneeza 3f69213
some clean up
shaneeza 8413e2d
merge conflict
shaneeza 4d97726
Merge branch 'main' of github.com:mongodb/leafygreen-ui into LG-4899-…
shaneeza 1616519
fix test
shaneeza 5d2ab30
lint
shaneeza b38c4f9
some cleanup
shaneeza 8aa3033
Merge branch 'main' of github.com:mongodb/leafygreen-ui into LG-4899-…
shaneeza 1460aa5
fix failing tests
shaneeza d55ae33
styleguide
shaneeza 55d7af8
update code and select
shaneeza 5140d06
remove constants folder and update exports
shaneeza 7fa641e
changeset for date picker
shaneeza 711cd8f
update styleguide
shaneeza 40e641e
fix lint and update styleguide
shaneeza b924e48
styleguide
shaneeza ac23442
Merge branch 'main' of github.com:mongodb/leafygreen-ui into LG-4899-…
shaneeza a13ff1b
add LgIdString type and update styleguide
shaneeza b0bb942
use root as default
shaneeza aa268ad
fix build error
shaneeza 95b3b93
remove memo
shaneeza 05a49da
fix failing text-area tests
shaneeza 3c4cdc6
update code lgIds to use root
shaneeza ff564be
update changeset
shaneeza 2a3427b
Merge branch 'main' of github.com:mongodb/leafygreen-ui into LG-4899-…
shaneeza cf5741e
update label to description in typography
shaneeza 7065ae8
merge conflicts
shaneeza 3a1ad90
lint
shaneeza e67df1b
remove default dataLgId
shaneeza 7f32cf0
no longer passing IDs to copyButton spec
shaneeza 161f668
add drawer changeset
shaneeza c195e3a
update changesets related to getLgIds
shaneeza 92e79eb
merge conflict
shaneeza 096d819
add data-testid
shaneeza 04776b8
fix failing tests
shaneeza b579f9e
move getLgIds in modal, move test ids in confirmation moda
shaneeza 935ec43
fix failing tests
shaneeza b556bca
Merge branch 'main' into LG-4899-getLgIds
shaneeza 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
This file contains hidden or 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,5 @@ | ||
--- | ||
'@leafygreen-ui/toggle': patch | ||
--- | ||
|
||
Updates `data-lgid` and `data-testid` to use scope based test IDs. These test IDs are generated using the helper utility `getLgIds`. For more information [check out the section in the styleguide about getLgIds](https://github.com/mongodb/leafygreen-ui/blob/main/STYLEGUIDE.md#getlgids). |
This file contains hidden or 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,5 @@ | ||
--- | ||
'@leafygreen-ui/lib': patch | ||
--- | ||
|
||
Export `LgIdString` type |
This file contains hidden or 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,42 @@ | ||
--- | ||
'@leafygreen-ui/code': major | ||
--- | ||
|
||
- Move `lgIds` to context, use `LgIdString` type, and remove setting `DEFAULT_LGID_ROOT`. | ||
- Update all IDs to return the unique root identifier passed to `data-lgid`: | ||
|
||
**Before** | ||
```tsx | ||
export const getLgIds = (root: LgIdString = DEFAULT_LGID_ROOT) => { | ||
const ids = { | ||
root, | ||
panel: `${DEFAULT_LGID_ROOT}-panel`, | ||
select: `${root}-select`, | ||
copyButton: `${DEFAULT_LGID_ROOT}-copy_button`, | ||
copyTooltip: `${DEFAULT_LGID_ROOT}-copy_tooltip`, | ||
expandButton: `${root}-expand_button`, | ||
skeleton: `${root}-skeleton`, | ||
pre: `${root}-pre`, | ||
title: `${DEFAULT_LGID_ROOT}-title`, | ||
} as const; | ||
return ids; | ||
}; | ||
``` | ||
|
||
**After** | ||
```tsx | ||
export const getLgIds = (root: LgIdString = DEFAULT_LGID_ROOT) => { | ||
const ids = { | ||
root, | ||
panel: `${root}-panel`, // Updated to use unique root identifier | ||
select: `${root}-select`, | ||
copyButton: `${root}-copy_button`, // Updated to use unique root identifier | ||
copyTooltip: `${root}-copy_tooltip`, // Updated to use unique root identifier | ||
expandButton: `${root}-expand_button`, | ||
skeleton: `${root}-skeleton`, | ||
pre: `${root}-pre`, | ||
title: `${root}-title`, // Updated to use unique root identifier | ||
} as const; | ||
return ids; | ||
}; | ||
``` |
This file contains hidden or 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,6 @@ | ||
--- | ||
'@leafygreen-ui/button': patch | ||
'@leafygreen-ui/drawer': patch | ||
--- | ||
|
||
Use `LgIdString` type and remove setting `DEFAULT_LGID_ROOT`. |
This file contains hidden or 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,26 @@ | ||
--- | ||
'@leafygreen-ui/confirmation-modal': major | ||
'@leafygreen-ui/gallery-indicator': major | ||
'@leafygreen-ui/password-input': major | ||
'@leafygreen-ui/split-button': major | ||
'@leafygreen-ui/form-footer': major | ||
'@leafygreen-ui/form-field': major | ||
'@leafygreen-ui/text-input': major | ||
'@leafygreen-ui/typography': major | ||
'@leafygreen-ui/text-area': major | ||
'@leafygreen-ui/checkbox': major | ||
'@leafygreen-ui/select': major | ||
'@leafygreen-ui/table': major | ||
'@leafygreen-ui/modal': major | ||
'@leafygreen-ui/menu': major | ||
'@leafygreen-ui/tabs': major | ||
--- | ||
|
||
Updates `data-lgid` and `data-testid` to use scope based test IDs. These test IDs are generated using the helper utility `getLgIds`. For more information [check out the section in the styleguide about getLgIds](https://github.com/mongodb/leafygreen-ui/blob/main/STYLEGUIDE.md#getlgids). | ||
|
||
Removes public exports for: | ||
- `LGIDs` | ||
- `LGIDS_CHECKBOX` | ||
- `LGIDS_FORM_FIELD` | ||
- `LGIDS_SELECT` | ||
- `LGIDS_TYPOGRAPHY` |
This file contains hidden or 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,5 @@ | ||
--- | ||
'@leafygreen-ui/date-picker': patch | ||
--- | ||
|
||
Updates spec file to use updated test ids for `@leafygreen-ui/form-field` components |
This file contains hidden or 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 hidden or 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 hidden or 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,6 +1,8 @@ | ||
import { LgIdString } from '@leafygreen-ui/lib'; | ||
|
||
export const DEFAULT_LGID_ROOT = 'lg-button'; | ||
|
||
export const getLgIds = (root: `lg-${string}` = DEFAULT_LGID_ROOT) => { | ||
export const getLgIds = (root: LgIdString = DEFAULT_LGID_ROOT) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessary here, but it might be worth creating a type GetLgIdsFunction = (root?: LgIdString) => {
root: LgIdString,
...
} |
||
return { | ||
root, | ||
} as const; | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 +1,7 @@ | ||
export { type CheckboxProps, checkWrapperClassName, default } from './Checkbox'; | ||
export { LGIDS_CHECKBOX } from './constants'; | ||
export { getTestUtils } from './utils'; | ||
export { | ||
DEFAULT_LGID_ROOT, | ||
getLgIds, | ||
type GetLgIdsReturnType, | ||
getTestUtils, | ||
} from './utils'; |
This file contains hidden or 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,12 @@ | ||
import { LgIdString } from '@leafygreen-ui/lib'; | ||
|
||
export const DEFAULT_LGID_ROOT = 'lg-checkbox'; | ||
|
||
export const getLgIds = (root: LgIdString = DEFAULT_LGID_ROOT) => { | ||
const ids = { | ||
root, | ||
} as const; | ||
return ids; | ||
}; | ||
|
||
export type GetLgIdsReturnType = ReturnType<typeof getLgIds>; |
This file contains hidden or 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 hidden or 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 +1,6 @@ | ||
export { | ||
DEFAULT_LGID_ROOT, | ||
getLgIds, | ||
type GetLgIdsReturnType, | ||
} from './getLgIds'; | ||
export { getTestUtils } from './getTestUtils'; |
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.
Uh oh!
There was an error while loading. Please reload this page.