Fix link + docs (#2476)

* Fix a copy/paste fail

Also, fix some incorrect tests.

* Clarify how routes are diffed, improve key + route resolver docs

- Add some missing links to route resolvers and single-child keyed
  fragments, clarify usage around them.
- Drive-by: remove a redundant sentence that itself was missing a
  period.

* Actually test for propagation and preventDefault

Previously, the mocks were both junk and inaccurate. No wonder my tests
were silently failing - they were wrong and not obviously wrong.
This commit is contained in:
Isiah Meadows 2019-07-16 16:03:24 -04:00 committed by GitHub
parent c3cca5f8e2
commit 4cbcaf2936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 288 additions and 108 deletions

View file

@ -237,17 +237,18 @@ module.exports = function($window, mountRedraw) {
// link target, etc. Nope, this isn't just for blind people.
if (
// Skip if `onclick` prevented default
result === false || !e.defaultPrevented &&
result !== false && !e.defaultPrevented &&
// Ignore everything but left clicks
(e.button === 0 || e.which === 0 || e.which === 1) &&
// Let the browser handle `target=_blank`, etc.
(!e.currentTarget.target || e.currentTarget.target === "_self") &&
// No modifier keys
!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey
) return
e.preventDefault()
e.redraw = false
route.set(href, null, options)
) {
e.preventDefault()
e.redraw = false
route.set(href, null, options)
}
}
}
return child