-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
{children} | ||
</div> | ||
{onRemove && ( | ||
<div css={itemCloseStyles} data-component-type="sortable.item.remove"> |
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.
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?
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.
maybe just data-type
?
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.
Hm... data-type
makes me think of arrays and hashmaps... maybe data-element
? Or even data-element-type
to maintain a similar naming pattern?
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.
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
?
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.
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.
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.
yes, let's keep it with data-display-name
then.
packages/Sortable/src/Sortable.js
Outdated
css={sortableStyles} | ||
data-display-name="sortable" |
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.
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.
packages/Sortable/package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@paprika/sortable", | |||
"version": "0.1.0", | |||
"version": "0.1.1", |
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.
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
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.
How about the devdependencies in paprika/package.json
file? Do we need to manually update it to keep it updated? @alexzherdev @nahumzs
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.
Good question, I suspect it should be part of our publishing procedure though.
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.
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
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.
Yep, reverted in a more recent commit.
π 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
moreProps
to root-level<ul>
element.provided.placeholder
to<Droppable>
so that its height is maintained while dragging.data-component-type
data-pka-anchor
attributes all over as per issue RFC Adding an anchor attribute for each component.Β #101