-
Notifications
You must be signed in to change notification settings - Fork 68
PD-1669 Add size variants to text input #1072
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2f4e165
update text input to include size variants
shaneeza 14b0a41
prettier fixes
shaneeza 3d8b482
updated website component
shaneeza cc49257
update readme again
shaneeza 481de43
prettier fixes
shaneeza a9514f1
added input text size
shaneeza fd71d19
changeset update
shaneeza 4d4305b
changed size default to default
shaneeza df90c45
Merge branch 'main' into PD-1669-text-input-sizes
shaneeza b39d99e
add padding
shaneeza 24f2ac3
remove medium size, add baseFontSize
shaneeza 57daa8e
naming updates, prettier fixes
shaneeza 3e4163b
update error font size
shaneeza 6df4df5
PD-1694 Upgrade `lib` dep in expandable card (#1073)
TheSonOfThomp 2ff0fb1
removed submodules and updated node version in readme (#1075)
shaneeza 9c27f93
Merge branch 'main' into PD-1669-text-input-sizes
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/text-input': minor | ||
--- | ||
|
||
Add sizeVariant prop |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
} from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { axe } from 'jest-axe'; | ||
import TextInput, { State } from './TextInput'; | ||
import TextInput, { State, SizeVariant } from './TextInput'; | ||
|
||
const error = 'This is the error message'; | ||
const validEmail = '[email protected]'; | ||
|
@@ -222,6 +222,21 @@ describe('packages/text-input', () => { | |
}); | ||
}); | ||
|
||
describe('when the "sizeVariant" is "large"', () => { | ||
test('check if font-size is 18px', () => { | ||
const { label } = renderTextInput({ | ||
value: validEmail, | ||
sizeVariant: SizeVariant.Large, | ||
optional: true, | ||
...defaultProps, | ||
}); | ||
|
||
expect(label).toHaveStyle({ | ||
fontSize: '18px', | ||
}); | ||
}); | ||
}); | ||
|
||
/* eslint-disable jest/expect-expect, jest/no-disabled-tests */ | ||
describe.skip('types behave as expected', () => { | ||
test('TextInput throws error when neither aria-labelledby or label is supplied', () => { | ||
|
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,8 @@ | ||
import TextInput, { TextInputType, State } from './TextInput'; | ||
export { TextInputType, State }; | ||
import TextInput, { | ||
TextInputType, | ||
State, | ||
SizeVariant, | ||
BaseFontSize, | ||
} from './TextInput'; | ||
export { TextInputType, State, SizeVariant, BaseFontSize }; | ||
export default TextInput; |
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
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 works for now, but this type of test is better suited to something like Chromatic or Percy
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.
We could even consider using this package https://www.npmjs.com/package/jest-image-snapshot