Skip to content
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

Conversation

luisFilipePT
Copy link
Contributor

@luisFilipePT luisFilipePT commented Sep 25, 2020

feat(select): add prop labelAlignment to select component

closes #1844

fix: #1844

Changes proposed in this PR:

image

image

image

image

@nexxtway/react-rainbow

@commit-lint
Copy link

commit-lint bot commented Sep 25, 2020

Features

  • select: add prop labelAlignment to select component (839ff64)

Tests

  • select: improve gramar on tests description (4815343)
  • select: remove failing tests following PR review (b4f4966)

Contributors

@luisFilipePT

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

@luisFilipePT luisFilipePT changed the title feat: Add prop labelAlignment to select component feat: add prop labelAlignment to select component Sep 25, 2020
const component = mount(<Select label="Select Label" required />);
expect(component.find('SelectStyledLabel').prop('labelAlignment')).toBe('center');
});
it('renders correctly with label left aligned', () => {
Copy link

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', () => {
Copy link

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)', () => {
Copy link

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', () => {
Copy link

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', () => {
Copy link

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', () => {
Copy link

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', () => {
Copy link

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.

@luisFilipePT
Copy link
Contributor Author

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?

@codeclimate
Copy link

codeclimate bot commented Sep 25, 2020

Code Climate has analyzed commit b4f4966 and detected 5 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 5

View more on Code Climate.

@TahimiLeonBravo TahimiLeonBravo merged commit cc1c3de into nexxtway:master Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add labelAlignment prop to the Select component
3 participants