sourcecred/sharness
William Chargin acdcbc29ed
Fix 404s in timeline and legacy-mode interlinks (#1305)
Summary:
All links in SourceCred must use the `Link` component, providing either
an external URL `href={…}` or an internal route `to={…}`. Any uses of a
raw `<a>` element for internal routes will incur 404s when the
application is hosted on a non-root path, as is currently the case on
the production website.

The change to `FileUploader` is not strictly necessary, as the link has
no styled text and uses a `data:` URL, but there’s no reason not to.

Fixes #1304.

Test Plan:
Build the static site:

```
scripts/build_static_site.sh --target cred --project sourcecred/example-github
```

Then run `python3 -m http.server` from the repository root directory—not
the `cred/` subdirectory—and navigate to the timeline cred view:
<http://localhost:8000/cred/timeline/sourcecred/example-github/>

Observe that the “(legacy)” link now has the correct styling and
correctly navigates to the legacy mode page when clicked: prior to this
change, it would navigate to a URL without the proper `/cred/` path
prefix, yielding a 404. On the legacy page, verify that the “timeline
mode” link has the same properties.

Then, visit <http://localhost:8000/cred/test/FileUploader/> and verify
that the inspection test still passes.

Added a regression test to catch further such errors. Note that
reverting the code changes in this commit causes the test to fail, and
that running it with `--verbose` prints the problematic files.

wchargin-branch: fix-bad-routing-404s
2019-08-18 14:43:34 -07:00
..
__snapshots__ Fixup project for move of example repos 2019-07-23 02:36:28 +01:00
.gitignore Add a `.gitignore` for Sharness (#673) 2018-08-15 16:31:00 -07:00
Makefile Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
SHARNESS_LICENSE Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
aggregate-results.sh Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
dummy.t Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
sharness.sh Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
test_build_static_site.t Fixup project for move of example repos 2019-07-23 02:36:28 +01:00
test_cli_scores.t Fixup project for move of example repos 2019-07-23 02:36:28 +01:00
test_js_tests_have_top_level_describe_block_with_filename.t Disable the Git plugin 2019-07-09 19:40:17 +01:00
test_load_example_github.t Fixup project for move of example repos 2019-07-23 02:36:28 +01:00
test_no_raw_anchor_elements.t Fix 404s in timeline and legacy-mode interlinks (#1305) 2019-08-18 14:43:34 -07:00