Skip to content

Commit c3b6a80

Browse files
author
nfrasser
committed
Better jQuery/HTML testing options
This makes it easier to edit sample HTML used in the test files - these are the tests that verify that linkify-element and linkify-jquery work
1 parent 010241b commit c3b6a80

File tree

7 files changed

+12
-33
lines changed

7 files changed

+12
-33
lines changed

src/linkify-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import {tokenize, options} from './linkify';
66

7-
let HTML_NODE = 1, TXT_NODE = 3;
7+
const HTML_NODE = 1, TXT_NODE = 3;
88

99
/**
1010
Given an array of MultiTokens, return an array of Nodes that are either

src/linkify-jquery.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,19 @@ function apply($, doc=null) {
5252
format: data.linkifyFormat,
5353
formatHref: data.linkifyFormatHref,
5454
newLine: data.linkifyNewline, // deprecated
55-
nl2br: data.linkifyNl2br,
55+
nl2br: !!data.linkifyNlbr,
5656
tagName: data.linkifyTagname,
5757
target: data.linkifyTarget,
5858
linkClass: data.linkifyLinkclass,
5959
};
60-
6160
let $target = target === 'this' ? $this : $this.find(target);
6261
$target.linkify(options);
6362
});
6463
});
6564
}
6665

6766
// Apply it right away if possible
68-
if (typeof jQuery !== 'undefined' && doc) {
67+
if (typeof __karma__ === 'undefined' && typeof jQuery !== 'undefined' && doc) {
6968
apply(jQuery, doc);
7069
}
7170

test/conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ module.exports = {
3636

3737
browserify: {
3838
debug: false,
39-
// transform: [ 'brfs' ]
39+
ignore: ['jsdom'],
40+
transform: ['brfs'],
41+
configure: function (bundle) {
42+
bundle.ignore('jsdom');
43+
},
4044
},
4145

4246
// test results reporter to use

test/spec/html-options.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

test/spec/html/extra.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div data-linkify="header" data-linkify-default-protocol="https" data-linkify-nlbr=true><header>Have a link to:
2+
github.com!</header></div><div id="linkify-test-div" data-linkify="this" data-linkify-tagname="i" data-linkify-target="_parent" data-linkify-linkclass="test-class" data-linkify-default-protocol="https" data-linkify-nl2br="1">Another [email protected] email as well as a http://t.co link.</div>

test/spec/html/linkified-alt.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello here are some links to <a href="ftp://awesome.com/?where=this" class="linkified" target="_blank" rel="nofollow">ftp://awesome.com/?where=this</a> and <a href="http://localhost:8080" class="linkified" target="_blank" rel="nofollow">localhost:8080</a>, pretty neat right? <p>Here's a nested <a href="http://github.com/SoapBox/linkifyjs" class="linkified" target="_blank" rel="nofollow">github.com/SoapBox/linkifyjs</a> paragraph</p>

test/spec/html/linkified.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello here are some links to <a href="ftp://awesome.com/?where=this" class="linkified" target="_blank">ftp://awesome.com/?where=this</a> and <a href="http://localhost:8080" class="linkified" target="_blank">localhost:8080</a>, pretty neat right? <p>Here's a nested <a href="http://github.com/SoapBox/linkifyjs" class="linkified" target="_blank">github.com/SoapBox/linkifyjs</a> paragraph</p>

0 commit comments

Comments
 (0)