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

[table] fix wrapText on EditableCell component #2701

Merged
merged 4 commits into from
Aug 1, 2018

Conversation

face
Copy link
Contributor

@face face commented Jul 16, 2018

Fixes #2700

Checklist

  • Enable CircleCI for your fork (I tried to do this, but circecli is not showing my fork, and there is an error that github service is partial degregated)
  • Include tests
  • Update documentation

Changes proposed in this pull request:

Fixes bug where wrapText={true} has doesn't work for

Reviewers should focus on:

fix and tests

Screenshot

@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @face! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint errors, please fix. Run yarn lint to see them locally.

@giladgray
Copy link
Contributor

Or click the failing build link, it has a nice report at the top

@face
Copy link
Contributor Author

face commented Jul 16, 2018

@giladgray thanks, lint fixed

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy enough!

expect(elem.find(`.${Classes.TABLE_NO_WRAP_TEXT} div`).length).to.equal(2);
});

it("wraps text when wrapsText is true", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapText

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

it("wraps text when wrapsText is true", () => {
const elem = mount(<EditableCell wrapText={true} />);

expect(elem.find(`.${Classes.TABLE_NO_WRAP_TEXT} div`).length).to.equal(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an inscrutable selector. Why the child div? Is it necessary? Can you come up with a more legible assertion? Maybe just the length of children on TABLE_NO_WRAP_TEXT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @giladgray. You are correct, the div is not necessary. Added children().length. Is this what you wanted?

it("defaults to no wrapText", () => {
const elem = mount(<EditableCell />);

expect(elem.find(`.${Classes.TABLE_NO_WRAP_TEXT}`).children().length).to.equal(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this doesn't do what you think it does: https://github.com/airbnb/enzyme/blob/master/docs/guides/migration-from-2-to-3.md#children-now-has-slightly-different-meaning.

i think this test can be simply expect(elem.find(.${Classes.TABLE_NO_WRAP_TEXT}).exists()).to.be.true; and the other one .to.be.false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the .exists() check is very intuitive: no wrap text means the NO_WRAP_TEXT element exists.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@face can I get a push from you real quick to resolve this?

@giladgray giladgray changed the title fixes #2700: adds wrapText prop to child Cell of EditableCell component [table] adds wrapText prop to child Cell of EditableCell component Jul 17, 2018
@giladgray giladgray changed the title [table] adds wrapText prop to child Cell of EditableCell component [table] fix wrapText on EditableCell component Jul 17, 2018
@giladgray
Copy link
Contributor

merging, will fix comments myself

@giladgray giladgray merged commit 2c419d4 into palantir:develop Aug 1, 2018
giladgray pushed a commit that referenced this pull request Aug 1, 2018
giladgray added a commit that referenced this pull request Aug 1, 2018
@face
Copy link
Contributor Author

face commented Aug 4, 2018

thanks @giladgray, sorry I dropped the ball and didn't see your request. I got pulled onto another project and am just now back on the one using bluprintjs. I need to figure out a better way to manage my github alerts as I would have addressed this had I not missed your request. thanks again for finalizing and merging the fix.

@giladgray
Copy link
Contributor

giladgray commented Aug 4, 2018 via email

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.

wrapText has no effect on EditableCell
3 participants