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

Add data-source-id, data-target-id on Link #234

Merged
merged 5 commits into from
Sep 11, 2019
Merged

Add data-source-id, data-target-id on Link #234

merged 5 commits into from
Sep 11, 2019

Conversation

lazToum
Copy link
Contributor

@lazToum lazToum commented Sep 4, 2019

It helps finding links between nodes (i.e. on node mouseOver, find the links related to this node.)

2019_09_04__14_09_52

It helps finding links between nodes (i.e. on node mouseOver find the links related to this node.
@coveralls
Copy link

coveralls commented Sep 4, 2019

Coverage Status

Coverage remained the same at 99.723% when pulling 869bd3a on lazToum:patch-1 into ef826e6 on bkrem:master.

@bkrem
Copy link
Owner

bkrem commented Sep 6, 2019

Hi @lazToum,

Great call on adding this, thank you! Could you please briefly add a test for this here https://github.com/bkrem/react-d3-tree/blob/master/src/Link/tests/index.test.js#L58 ?

A single test along the lines of "binds IDs of source & target nodes to data-source-id/data-target-id" prop should do the trick 👍 I'll merge, update docs and release once that's done.

Let me know if there are any issues!

@lazToum
Copy link
Contributor Author

lazToum commented Sep 7, 2019

Hi @lazToum,

Great call on adding this, thank you! Could you please briefly add a test for this here https://github.com/bkrem/react-d3-tree/blob/master/src/Link/tests/index.test.js#L58 ?

A single test along the lines of "binds IDs of source & target nodes to data-source-id/data-target-id" prop should do the trick +1 I'll merge, update docs and release once that's done.

Let me know if there are any issues!

Something like this?

it('binds IDs of source & target nodes to data-source-id/data-target-id', () => {

I also added one more in case a source/target does not have an "id" key.

@bkrem
Copy link
Owner

bkrem commented Sep 11, 2019

Yup this is looking good thank you! 👍

I'm fine with merging like this but I'm wondering what the fallback scenario (no id field) is needed if all nodes automatically generate UUIDs?

@lazToum
Copy link
Contributor Author

lazToum commented Sep 11, 2019

Yup this is looking good thank you! +1

I'm fine with merging like this but I'm wondering what the fallback scenario (no id field) is needed if all nodes automatically generate UUIDs?

Well it is only needed if a Link is used as a standalone element like in the test file where one can supply only the x,y props of the source and target. But you are correct, inside a Tree instance this check is not necessary. Should I remove it?

@bkrem
Copy link
Owner

bkrem commented Sep 11, 2019

Yeah I think we can safely disregard this scenario. A node should always have an ID, and if it doesn't returning undefined for data-source-id/data-target-id would be the expected result.

Thank you for taking this into consideration though 💯

Will merge, document & publish once that's done :)

@lazToum
Copy link
Contributor Author

lazToum commented Sep 11, 2019

Yeah I think we can safely disregard this scenario. A node should always have an ID, and if it doesn't returning undefined for data-source-id/data-target-id would be the expected result.

Thank you for taking this into consideration though 100

Will merge, document & publish once that's done :)

Great, thanks!

@lazToum lazToum closed this Sep 11, 2019
@lazToum lazToum reopened this Sep 11, 2019
@bkrem bkrem changed the base branch from master to pr/data-target-id September 11, 2019 13:53
@bkrem bkrem merged commit 292b5a2 into bkrem:pr/data-target-id Sep 11, 2019
@lazToum lazToum deleted the patch-1 branch September 11, 2019 13:54
bkrem pushed a commit that referenced this pull request Sep 11, 2019
* Add data-source-id, data-target-id on Link

It helps finding links between nodes (i.e. on node mouseOver find the links related to this node.

docs(link data attributes): adds documentation for Link data attributes
bkrem pushed a commit that referenced this pull request Sep 11, 2019
* Add data-source-id, data-target-id on Link

It helps finding links between nodes (i.e. on node mouseOver find the links related to this node.

docs(link data attributes): adds documentation for Link data attributes

test: use identity assertion (`toBe`) instead of equality (`toEqual`)
@bkrem
Copy link
Owner

bkrem commented Sep 11, 2019

Shipped as v1.15.0

Thank you again 👏

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.

3 participants