Skip to content

Commit a2aeeb2

Browse files
committed
Add tests for domain labels with dashes
1 parent 1ceee77 commit a2aeeb2

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/parser/uri-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function isDomainLabelStartChar(char: string): boolean {
107107
* A domain label is a segment of a hostname such as subdomain.google.com.
108108
*/
109109
export function isDomainLabelChar(char: string): boolean {
110-
return alphaNumericAndMarksRe.test(char) || char === '_';
110+
return char === '_' || isDomainLabelStartChar(char);
111111
}
112112

113113
/**

tests-integration/test-require.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const Autolinker = require('autolinker');
88
const NamedAutolinker = require('autolinker').Autolinker;
99

10-
describe('Autolinker require() tests - ', () => {
10+
describe('Autolinker require() tests >', () => {
1111
it(`Autolinker should be the default export of 'autolinker'`, () => {
1212
expect(Autolinker).toEqual(jasmine.any(Function)); // constructor function
1313
expect(Autolinker.name).toBe('Autolinker'); // function name

tests/autolinker-url.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('Autolinker Url Matching >', () => {
1818
'yahoo.com',
1919
'subdomain1.subdomain2.yahoo.com',
2020
'subdomain_with_underscores.yahoo.com',
21+
'subdomain-with-dashes.some-domain.com',
2122
'localhost',
2223
'66.102.7.147',
2324
],

0 commit comments

Comments
 (0)