Skip to content

Commit

Permalink
Added test for UTF-8 encoded internal links
Browse files Browse the repository at this point in the history
There wasn't a specific test for this, and it fails on some setups.

The link in the fixture is a direct copy-paste from one that fails on my project.

But the test passes on this test suite... So there is something else going on.

Relates to gjtorikian#757
  • Loading branch information
ahpook committed May 23, 2024
1 parent 3aa6347 commit 4958ecb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/html-proofer/check/links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
expect(proofer.failed_checks.first.description).to(match(/internally linking to #noHash; the file exists, but the hash 'noHash' does not/))
end

it "passes for internal links with non-ASCII characters" do
broken_hash_internal_filepath = File.join(FIXTURES_DIR, "links", "hash_nonascii.html")
proofer = run_proofer(broken_hash_internal_filepath, :file)
expect(proofer.failed_checks).to(eq([]))
end

it "passes for broken internal hash when asked to ignore" do
broken_hash_internal_filepath = File.join(FIXTURES_DIR, "links", "broken_hash_internal.html")
proofer = run_proofer(broken_hash_internal_filepath, :file, check_internal_hash: false)
Expand Down
8 changes: 8 additions & 0 deletions spec/html-proofer/fixtures/links/hash_nonascii.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<body>
<p>Blah blah blah. <a href="#eigentümerschaft">Hash mit ein umlaut</a></p>

<h2 id="eigentümerschaft">Hier gib's</h2>
</body>
</html>

0 comments on commit 4958ecb

Please sign in to comment.