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

PD-12484 Cypress tests for Sortable component 🐐 #110

Merged
merged 7 commits into from
Jul 5, 2019

Conversation

mikrotron
Copy link
Contributor

@mikrotron mikrotron commented Jul 4, 2019

πŸ›  Purpose

Add test coverage for the new <Sortable> component.

✏️ Notes to Reviewer

Test cases:
βœ“ it should be re-orderable by mouse
βœ“ it should ignore out-of-bounds drops
βœ“ it should be re-orderable by keyboard
βœ“ it should allow items to be removed

Was unable to get tests working with react-testing-library, despite one person's claim

🌟 Bonus

{children}
</div>
{onRemove && (
<div css={itemCloseStyles} data-component-type="sortable.item.remove">
Copy link
Contributor Author

@mikrotron mikrotron Jul 4, 2019

Choose a reason for hiding this comment

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

Too much to add data-component-type throughout the DOM to allow precise control over styling (or testing)? Or maybe just a different attribute name would be more appropriate since these aren't really components?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just data-type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm... data-type makes me think of arrays and hashmaps... maybe data-element? Or even data-element-type to maintain a similar naming pattern?

Copy link
Contributor

Choose a reason for hiding this comment

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

ohhh I suggested data-type because I thought data-component-type was too long, but on that note, I would suggested data-react-display-name="" maybe? or just data-display-name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh. Yeah, both component-type and display-name are used in the issue #101 so it's not clear what is actually being proposed.

I like component-type better, but since we already set the .displayName for our components as a convention (https://github.com/acl-services/paprika/blob/master/packages/Sortable/src/Sortable.js#L87) maybe it's best to keep with the same name to reduce cognitive load?

I was worried this might derail this PR, and it's not really that important at this point, but it's also a decision I would rather force now than just kick down the road.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, let's keep it with data-display-name then.

css={sortableStyles}
data-display-name="sortable"
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to #101 (comment), this is even more confusing to me because it's on a DOM component. To an outside observer, this looks like some magical way of setting displayName on this <ul>, which it isn't.

@@ -1,6 +1,6 @@
{
"name": "@paprika/sortable",
"version": "0.1.0",
"version": "0.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to update versions manually in PRs. It should be handled by lerna when you publish (at which point you determine whether it's a major/minor/patch bump). cc @nahumzs

Copy link
Contributor

@allison-c allison-c Jul 5, 2019

Choose a reason for hiding this comment

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

How about the devdependencies in paprika/package.json file? Do we need to manually update it to keep it updated? @alexzherdev @nahumzs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, I suspect it should be part of our publishing procedure though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Lerna allowed the option of manually bumping the version vs automatically handle. Maybe we should discuss this a little further, but right now you don't need to bump the version mike

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, reverted in a more recent commit.

@mikrotron mikrotron merged commit ae98879 into master Jul 5, 2019
@mikrotron mikrotron deleted the PD-12484/sortable-tests branch July 17, 2019 01:11
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.

4 participants