Fix urls2links unit test

This commit is contained in:
Haocen Xu 2020-06-02 08:50:14 -04:00
parent 9b138fd5fd
commit 65011019b7
No known key found for this signature in database
GPG Key ID: 3F0D955A0F6AD729
2 changed files with 3 additions and 3 deletions

View File

@ -408,7 +408,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
DOMPurify.sanitize( DOMPurify.sanitize(
element.html().replace( element.html().replace(
/(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig, /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
'<a href="$1" rel="nofollow">$1</a>' '<a href="$1" rel="nofollow noopener noreferrer">$1</a>'
) )
) )
); );

View File

@ -125,7 +125,7 @@ describe('Helper', function () {
let result = e.html(); let result = e.html();
clean(); clean();
url = $('<div />').text(url).html(); url = $('<div />').text(url).html();
return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow">' + url + '</a>' + $('<div />').text(postfix).html() === result; return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow noopener noreferrer">' + url + '</a>' + $('<div />').text(postfix).html() === result;
} }
); );
jsc.property( jsc.property(
@ -145,7 +145,7 @@ describe('Helper', function () {
let result = e.html(); let result = e.html();
clean(); clean();
url = $('<div />').text(url).html(); url = $('<div />').text(url).html();
return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow">' + url + '</a>' + $('<div />').text(postfix).html() === result; return $('<div />').text(prefix).html() + '<a href="' + url + '" rel="nofollow noopener noreferrer">' + url + '</a>' + $('<div />').text(postfix).html() === result;
} }
); );
}); });