Skip to content

Commit 8acea3c

Browse files
author
nfrasser
committed
Minor test fixes for various interfaces
1 parent 8dade71 commit 8acea3c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/spec/linkify-jquery-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ describe('linkify-jquery', function () {
5555
// Make sure we start out with a fresh DOM every time
5656
beforeEach(() => testContainer.innerHTML = htmlOptions.original);
5757

58-
// This works but is inconsistent across browsers
5958
it('Works with the DOM Data API', () => {
6059
expect($('header').first().html()).to.be.eql(
6160
'Have a link to:<br><a href="https://github.com" class="linkified" target="_blank">github.com</a>!'

test/spec/linkify-string-test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ describe('linkify-string', () => {
5555
'The URL is google.com and the email is [email protected]',
5656
'The URL is <a href="http://google.com" class="linkified" target="_blank">google.com</a> and the email is <a href="mailto:[email protected]" class="linkified">[email protected]</a>',
5757
'The URL is <span href="https://google.com" class="my-linkify-class" target="_parent" rel="nofollow" onclick="javascript:alert(&quot;Hello&quot;);">google.com</span> and the email is <span href="mailto:[email protected]?subject=Hello%20from%20Linkify" class="my-linkify-class" target="_parent" rel="nofollow" onclick="javascript:alert(&quot;Hello&quot;);">[email protected]</span>',
58-
'The URL is google.com and the email is [email protected]',
5958
], [
6059
'Super long maps URL https://www.google.ca/maps/@43.472082,-80.5426668,18z?hl=en, a #hash-tag, and an email: [email protected]!\n',
6160
'Super long maps URL <a href="https://www.google.ca/maps/@43.472082,-80.5426668,18z?hl=en" class="linkified" target="_blank">https://www.google.ca/maps/@43.472082,-80.5426668,18z?hl=en</a>, a #hash-tag, and an email: <a href="mailto:[email protected]" class="linkified">[email protected]</a>!\n',
@@ -75,15 +74,15 @@ describe('linkify-string', () => {
7574
});
7675
});
7776

78-
// Test specific options
79-
it('Works with overriden options (validate)', () => {
80-
const validateOptions = {
77+
describe('Validation', () => {
78+
// Test specific options
79+
const options = {
8180
validate: function (text, type) {
8281
return type !== 'url' || /^(http|ftp)s?:\/\//.test(text) || text.slice(0,3) === 'www';
8382
}
8483
};
8584

86-
const validateTests = [
85+
const tests = [
8786
[
8887
'1.Test with no links',
8988
'1.Test with no links'
@@ -105,8 +104,10 @@ describe('linkify-string', () => {
105104
]
106105
];
107106

108-
validateTests.map(function (test) {
109-
expect(linkifyStr(test[0], validateOptions)).to.be.eql(test[1]);
107+
it('Works with overriden options (validate)', function () {
108+
tests.map(function (test) {
109+
expect(linkifyStr(test[0], options)).to.be.eql(test[1]);
110+
});
110111
});
111112
});
112113
});

0 commit comments

Comments
 (0)