Skip to content

Commit

Permalink
chore: tidying up some comments and tests around the new   feature
Browse files Browse the repository at this point in the history
Closes #141
  • Loading branch information
bryanbraun committed Oct 3, 2020
1 parent 83ce396 commit 7fb74c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@
textareaElement.innerHTML = text;
text = textareaElement.value;

// Regex for finding the non-safe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\ (newlines, tabs, backspace, & vertical tabs)
// Regex for finding the non-safe URL characters (many need escaping):
// & +$,:;=?@"#{}|^~[`%!'<>]./()*\ (newlines, tabs, backspace, vertical tabs, and non-breaking space)
var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v\u00A0]/g,
urlText;

Expand Down
2 changes: 1 addition & 1 deletion test/spec/AnchorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ describe('AnchorJS', function() {
var text1Before = 'one&two three+four$five,six:seven;eight=nine?ten',
text2Before = 'one@two"three#four{five}six|seven^eight~nine[ten',
text3Before = 'one`two%three!four]five.six/seven(eight)nine*ten',
text4Before = 'one\\two<three>four\nfive\tsix\bseven\veight\n\nnine\t\tten',
text4Before = 'one\\two<three>four\nfive\tsix\bseven\veight&nbsp;nine\n\nten',
after = 'one-two-three-four-five-six-seven-eight-nine-ten';

expect(anchors.urlify(text1Before)).toEqual(after);
Expand Down
4 changes: 4 additions & 0 deletions test/visual-check.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ <h3>Other languages 追溯到 - അടിത - Загол</h3>

<hr />

<h3>Non-breaking spaces should not appear in this&nbsp;link</h3>

<hr />

<h1>Examples of anchors for different length titles</h1>
<h4>Updating</h4>
<h4>Updating this project</h4>
Expand Down

0 comments on commit 7fb74c2

Please sign in to comment.