-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
feat: add prop labelAlignment to select component #1855
feat: add prop labelAlignment to select component #1855
Conversation
Features
Tests
ContributorsCommit-Lint commandsYou can trigger Commit-Lint actions by commenting on this PR:
|
const component = mount(<Select label="Select Label" required />); | ||
expect(component.find('SelectStyledLabel').prop('labelAlignment')).toBe('center'); | ||
}); | ||
it('renders correctly with label left aligned', () => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
'flex-start', | ||
); | ||
}); | ||
it('renders correctly with label right aligned', () => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
|
||
expect(getComputedStyle(elem.getDOMNode()).getPropertyValue('align-self')).toBe('center'); | ||
}); | ||
it('renders correctly with label centered by passing prop (explicit)', () => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
@@ -29,4 +29,42 @@ describe('Select component', () => { | |||
const component = mount(<Select label="Select Label" required />); | |||
expect(component.find('RequiredAsterisk').prop('required')).toBe(true); | |||
}); | |||
it('should set "left" to labelAlignment prop passed in the Label component', () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
const component = mount(<Select label="Select Label" required labelAlignment="left" />); | ||
expect(component.find('SelectStyledLabel').prop('labelAlignment')).toBe('left'); | ||
}); | ||
it('should set "right" to labelAlignment prop passed in the Label component', () => { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
const component = mount(<Select label="Select Label" required />); | ||
expect(component.find('SelectStyledLabel').prop('labelAlignment')).toBe('center'); | ||
}); | ||
it('renders correctly with label aligned left', () => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
'flex-start', | ||
); | ||
}); | ||
it('renders correctly with label aligned right', () => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
Some tests are failing, but they run fine locally (see printscreen in the description) and they follow the same logic as ones ina previous pull request that passed :/ (#1834) @LeandroTorresSicilia can you check? |
Code Climate has analyzed commit b4f4966 and detected 5 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
feat(select): add prop labelAlignment to select component
closes #1844
fix: #1844
Changes proposed in this PR:
@nexxtway/react-rainbow