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

Fix the hash prop on Links #2224

Merged
merged 2 commits into from
Oct 9, 2015
Merged

Fix the hash prop on Links #2224

merged 2 commits into from
Oct 9, 2015

Conversation

timdorr
Copy link
Member

@timdorr timdorr commented Oct 9, 2015

Fixes #2216

@timdorr timdorr added the bug label Oct 9, 2015
@@ -289,23 +289,27 @@ describe('A <Link>', function () {
// just here to make sure click handlers don't prevent it from happening
}
render() {
return <Link to="/hello" onClick={(e) => this.handleClick(e)}>Link</Link>
return <Link to="/hello" hash="#world" onClick={(e) => this.handleClick(e)}>Link</Link>
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a query prop here as well, to be a bit more stringent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 81cccce

Copy link
Member Author

Choose a reason for hiding this comment

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

And I'll wait for the +1 next time 😄

timdorr added a commit that referenced this pull request Oct 9, 2015
@timdorr timdorr merged commit 8a3ea17 into remix-run:master Oct 9, 2015
@timdorr
Copy link
Member Author

timdorr commented Oct 9, 2015

Oh shit, merged too quickly. I was waiting on tests to pass. I'll follow up on the comments.

@timdorr timdorr deleted the test-link-hash branch October 9, 2015 18:10
@aszwemin
Copy link

aszwemin commented Oct 9, 2015

I think that will still not jump to the fragment, made similar fix in my local branch initially, but it only solved url.

@mjackson
Copy link
Member

mjackson commented Oct 9, 2015

np :) In general, it's probably best if we all wait to get at least one 👍 from another collab before merging.

@mjackson
Copy link
Member

mjackson commented Oct 9, 2015

@aszwemin Jumping to the fragment is a scrolling problem, which is a separate issue.

@timdorr
Copy link
Member Author

timdorr commented Oct 9, 2015

It's because the URL is being constructed the wrong way. The hash fragment and query string are out of order. I'm going to submit an issue on history about it.

@taion
Copy link
Contributor

taion commented Oct 9, 2015

Do we need any sanity checks here when using hash history?

@timdorr
Copy link
Member Author

timdorr commented Oct 9, 2015

Well, we're now testing another aspect of it (I'd love to get some coverage reports generated...) but I think it's warranted.

But once the bug in history is fixed, this line:

expect(spy).toHaveBeenCalledWith({ you: 'doing?' }, '/hello#world?how=are')

changes to:

expect(spy).toHaveBeenCalledWith({ you: 'doing?' }, '/hello?how=are#world')

So, it's not so much of a sanity check. It's actually testing the valid construction of a URL.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants