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

added tests and root functionality #49

Merged
merged 8 commits into from
Sep 4, 2016

Conversation

krawaller
Copy link
Contributor

This PR extends the signature of href to href(cb, root), where root is an optional dom node that we will never capture clicks outside of.

When adding tests for this I also added missing test for the basic href functionality, including the data attribute thing that @jliuhtonen implemented in #27.

@@ -9,14 +9,14 @@ const noRoutingAttrName = 'data-no-routing'
// and url lives on the same domain. Replaces
// trailing '#' so empty links work as expected.
// fn(str) -> null
Copy link
Owner

Choose a reason for hiding this comment

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

could you change the signature to be:

// (fn(str), obj?) -> null

thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, sorry, good catch! Fixing!

@yoshuawuyts
Copy link
Owner

sweet, thanks!

@krawaller
Copy link
Contributor Author

Gah, apparently forgot to use my brain in that first comment signature fix. Should be better now. :P

@jliuhtonen
Copy link
Contributor

Btw, to be exact, the function returns undefined, not null.

In addition to the tests in place, I think href needs actual browser tests, but this is something that we can look into later on.

👍

@krawaller
Copy link
Contributor Author

Whoops again, good catch @jliuhtonen.

Agreed on unit tests alone not really feeling sufficient here. Also agreed on dealing with that later. :)

@@ -8,15 +8,15 @@ const noRoutingAttrName = 'data-no-routing'
// handle a click if is anchor tag with an href
// and url lives on the same domain. Replaces
// trailing '#' so empty links work as expected.
// fn(str) -> null
function href (cb) {
// (fn(str), obj?) -> undefined
Copy link
Owner

Choose a reason for hiding this comment

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

could you leave this as null? thanks - I know it's only a convention and not enforced so I know it's a bit silly but yeah I use null like C's void return. Thank you!

Copy link
Owner

Choose a reason for hiding this comment

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

ah well, whatever. Merging!

@yoshuawuyts yoshuawuyts merged commit 35bd988 into yoshuawuyts:master Sep 4, 2016
@yoshuawuyts
Copy link
Owner

Thanks! I'll publish this at a later time as master isn't published yet. Cheers!

@fyrkant fyrkant mentioned this pull request Oct 20, 2016
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